Hi,
Sorry about that. I should have searched the posts...
Both methods works perfectly. My first posting was however not 100%
correct. In addition to Id1 and Id2 I have several other variabels in
the dataset. When I run the code you suggested for me the other
variabels stays the way they were before.
Eg
Id1 Id2 Gender
1 2 Male
2 4 Female
3 5 Female
4
5
Then i run the code:
levels Id2, local(levels)
replace Id2 = .
foreach l of local levels {
qui replace Id2 = `l' if Id1 == `l'
}
And the result is:
Id1 Id2 Gender
1 . Male
2 2 Female
3 . Female
4 4
5 5
I would like the variabel 'Gender' to follow Id2
Eg.
Id1 Id2 Gender
1 . .
2 2 Male
3 . .
4 4 Female
5 5 Female
I have tried to modify your code, but I cannot make it work...
Any suggestions would be greatly appreciated.
Nick, did you get any results on your post 'MS software and Stata: a
proposal', tips and tricks for exporting Stata results into MS Office
applications? If not, I can try to make a FAQ like you proposed.
Best regards,
Alexander Severinsen
-----Opprinnelig melding-----
Fra: [email protected]
[mailto:[email protected]] P� vegne av Nick Cox
Sendt: 11. april 2003 14:09
Til: [email protected]
Emne: st: RE: SV: RE: Making symmetry
Alexander
> The 'gen draft...' method works perfectly.
>
> It seems like the first method with 'levels' is only for
> version 8 of
> stata? It get the error message; version 8 not supported...
The same question was asked on 8 April,
so here is the same answer:
> In detail, yes. In general, please note the advice in
> the Statalist FAQ
> "The current version of Stata is 8. Please specify if you are
> using an earlier version; otherwise, the answer to your
> question is likely to refer to commands or features
> unavailable to you."
> In particular, the description yielded by
> . ssc inst levels
> explains that -levels- is for Stata 8, and that -levels7-
> is available for Stata 7. So just substitute -levels7-
> for -levels-.
Nick
[email protected]
*
* 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/
*
* 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/