Dear all,
I need a bit of help reshaping a large number of variables. In my dataset I have a lot (>100) variables
ending in "v1", "v2", or "v3", representing variables for village 1, 2, or 3. Is there a quick way to reshape all these variables from this wide format into a long format, where each observation corresponds to a single village?
I was thinking to do something along this line:
*put all variable names in a local macro
unab mylist : *v1 *v2 *v3
*eliminate the trailing number from each name and put new names in a new local macro
*not sure how to do this
*reshape using the new local macro
reshape long `newlist', i(id) j(villagenr)
Any help is greatly appreciated.
-radu ban
*
* 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/