Thanks for what you do, I have benefited from your discussions for a long time before registering.
I will try to be as clear as I can, any advice about the form or contents of future posts are more than welcome.
I am working with a very messy dataset extracted from PSID. I know there exists a package by Prof. Kohler about it but I am not able to use it at the current state. I have a wide form dataset with cyclically repeated variables: to exemplify it, let's say that I have an ID variable for each family as the first vector and after that a set of N variables for each year. N is NOT constant throughout the years. Therefore, we will see all families with N variables for year 1968 (first), with N+2 variables for 1969, etc...
The structure would be like this:
ID | A // B // C | D // E // F // G | ....
Notice than A-D, B-E, C-F are the SAME variables, but with different names.
What I need is to eventually use a reshape of the following form:
Code:
reshape long **ReadyData**, i(ID) j(year)
Code:
ds, has (varl *INTERVIEW*) foreach v of var `r(varlist)' { local label : var label `v' local newlabel = substr(`"`label'"', 1, 4) rename `v' ER_`newlabel' }
Code:
ds, has (varl *INTERVIEW*)
Many thanks,
Francesco
0 Response to Renaming with nested loops over irregularly repeated variables in order to prepare data for RESHAPE
Post a Comment