Hi,
I got 2 prepared data sets which were constructed differently, the
first one goes like other standard data set assigning each observation
in one row. The other contains drugs data which was set vertically so
for each observation there may be several records put downwardly. The
primary key for linkage is ID and they appear like below:
Data set #1
id        age      disease
1        23        0
2        32        1
3        28        1
4        27        0
Data set #2
id      drug
1      A1
1      B2
1      C1
2      B2
2      B3
3      A1
3      B3
I wonder if there is a quick way to merge the two so that each
observation come in one row. This may involve creating either nominal
variables for each drug at alphanumeric level (A1, A2, B1, B2) or
count variables at alpha level (A/B/C) - so should look like this:
id        age      disease       A1         A2         B1          B2
       B3          C1         drugA     drugB    drugC
1        23        0                1            0            0
    1            0            1            1            1            1
2        32        1                0            0            0
    1            1            0            0            2            0
3        28        1                1            0            0
    0            1            0            1            1            0
Thank you,
Aca
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/