Hello Statlist-Users,
I know that there has been written a lot about that topic but non of the solutions worked out for me.
The question is simple: I want to keep variable labels of a large dataset after reshaping it to long format.
Problem: my dataset is quite big with more than 3,500 variables in wideformat (most variables go from 1995 - 2011) turning to about 600 variables after the reshape.
All variables have the form var1_1995, var1_1996, ... , var1_2011; var2_1995,...,var2_2011; and so on.
Thus, in order to simplify my reshape, I do the following:
The unab command therefore creates a macro extracting the basic form of each variable --> var1_ var2_ var3_ etc.
Is there a way to also transfer variable labels from wide to long when proceeding like just explained?
Thanks a lot in advance, I hope somebody can help me out.
Philipp
I know that there has been written a lot about that topic but non of the solutions worked out for me.
The question is simple: I want to keep variable labels of a large dataset after reshaping it to long format.
Problem: my dataset is quite big with more than 3,500 variables in wideformat (most variables go from 1995 - 2011) turning to about 600 variables after the reshape.
All variables have the form var1_1995, var1_1996, ... , var1_2011; var2_1995,...,var2_2011; and so on.
Thus, in order to simplify my reshape, I do the following:
Code:
unab mylist: *_2011 foreach v of local mylist { local stubs `"`stubs' `=substr("`v'",1,length("`v'")-4)'"' } reshape long "`stubs'", i(EF1) j(Jahr)
Is there a way to also transfer variable labels from wide to long when proceeding like just explained?
Thanks a lot in advance, I hope somebody can help me out.
Philipp
Comment