Hi everyone,
I am working with survey data. It is panel data over the course of 11 years (1991-2002). I want to use "xtset pid year" to declare to STATA that my data is panel data with "pid" (person id) and "year" (for each of the 11 waves of the survey). There is a problem though. My panel data does not have year-wise data. It has tons of variables, with each variable prefixed A for wave one, B for wave two, C for wave three and so on, until K for wave 11. Some examples are: 'ahid' for the household ID in wave 1, 'bhid' for household ID in wave 2, and so on. (You can have a sneak at a wide form of the data in the screenshot above!)
I have been trying to hard to extract the prefix alphabet and map 'a' to 1991, 'b' to 1992 and so on but I'm just failing at this. I'm so stressed and I cannot figure out how to fix this! I would be forever indebted for any help that you could give me.
Thank you so much!
Comment