Dear Statalisters
I would be most gratfeul if someone could advise me on the following:
I am working with long data and need to create a variable that
summarises information from several categorical variables. For
example, for the variables hdage1-hdage4, I want to create a single
variable that tells me which category each pid belongs to (the
opposite of the command (ta var, ge(var*) )) . Thus, for the first
person, I want a variable that lists age3 at each wave, for the second
age3 in the same variable etc.
Any help would be most apprecaited.
Regards
Sara
+-----------------------------------------------------+
pid wave age1 age2 age3 age4
-----------------------------------------------------
22. 10014608 1 0 0 0 1
23. 10014608 2 0 0 0 1
24. 10014608 3 0 0 0 1
25. 10014608 6 0 0 0 1
26. 10014608 8 0 0 0 1
27. 10014608 9 0 0 0 1
28. 10014608 10 0 0 0 1
29. 10014608 12 0 0 0 1
-----------------------------------------------------
30. 10016813 2 0 0 1 0
31. 10016813 4 0 0 1 0
32. 10016813 9 0 0 1 0
*
* 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/