# st: RE: RE: RE: RE: Resdesigning dyadic data formats

 From "Nick Cox" <[email protected]> To <[email protected]> Subject st: RE: RE: RE: RE: Resdesigning dyadic data formats Date Wed, 21 Apr 2004 14:43:34 +0100

```This is set as an exercise to see if you understood
the lesson. Alternatively, an untested solution
is at the end.

How to move step by: step. Stata Journal 2(1):86-102.

(explains the use of the by varlist : construct to tackle
a variety of problems with group structure, ranging from
simple calculations for each of several groups to more
advanced manipulations that use the built-in _n and _N)

Nick
[email protected]

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Neumayer,E
> Sent: 21 April 2004 14:24
> To: [email protected]
> Subject: st: RE: RE: RE: Resdesigning dyadic data formats
>
>
> there are dyads in just one year. But assume now that there
> is also a year variable. OK, with "fillin c1 c2 year" I get
> the dataset in a nice rectangular shape. What adjustment do I
> need to make for the other four lines:
>
> gen max = max(c1,c2)
> gen min = min(c1,c2)
> bysort max min (x) : assert _N == 2
> by max min: replace x = x[1] if missing(x)
>

gen max = max(c1,c2)
gen min = min(c1,c2)
bysort max min (year x) : assert _N == 2
by max min year: replace x = x[1] if missing(x)

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```