Dear all,
First-time poster here. I am using the PSID data set and want to include all the variables from waves in my analysis. I am aware that it will be a huge dataset. As you know the PSID variable names are not consistently coded across waves. I renamed all the variables by their variable labels using -lab2varn. Now I want to rename the variable names so that the numeric values you see in the names end up as suffixes. For example, “education_1980_ head” should become something like “education_ head_80”. “tot_txbl_income_80_81” should become “tot_txbl_income_81”. The goal is to have proper stub names with year suffix to ultimately create a panel. Maybe running a loop that does it to all variable names can be helpful. How should I approach this?
Thank you for your help!
input byte release_number float _1968_INTERVIEW_NUMBER byte(education_1980_head education_1980_wife education_1981_head education_1981_wife) long tot_txbl_income_80_81
2 2 1 1 1 0 0
2 2 1 1 1 0 0
2 2 1 1 . . 0
2 4 2 3 2 3 25000
2 4 2 3 2 3 0
2 4 3 3 3 3 10000
2 4 7 4 7 4 3000
2 4 3 2 3 2 0
2 4 2 3 . . 0
2 4 2 3 2 3 0
2 4 3 3 3 3 0
2 4 3 2 3 2 0
2 4 3 3 3 3 0
2 4 3 2 3 2 0
2 4 7 4 7 4 0
2 4 7 4 7 4 0
2 4 2 3 . . 0
2 4 3 3 3 3 0
2 4 3 2 3 2 0
2 4 3 3 3 3 0
2 4 3 3 3 3 0
2 4 2 3 2 3 0
2 4 2 3 2 3 0
2 4 3 3 3 3 0
2 4 3 3 3 3 0
2 4 2 3 2 3 0
2 4 3 3 3 3 0
2 4 3 2 3 2 16600
2 4 7 4 7 4 22480
2 4 3 3 3 3 10000
2 4 2 3 2 3 0
2 4 2 3 2 3 0
2 4 2 3 . . 0
2 4 3 3 3 3 0
2 4 3 3 3 3 0
2 4 3 3 3 3 0
2 4 3 3 3 3 0
2 5 3 3 3 3 12200
2 5 3 3 3 3 0
2 5 3 3 3 3 3050
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 5 3 3 3 3 0
2 6 2 4 2 4 2000
2 6 2 4 2 4 4700
2 6 3 5 3 5 12500
2 6 7 7 7 7 4600
2 6 3 5 3 5 0
2 6 3 5 3 5 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 3 5 3 5 30000
2 6 3 5 3 5 0
2 6 7 7 7 7 12500
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 6 7 7 7 7 0
2 7 2 2 2 2 3300
2 7 2 2 2 2 0
2 7 4 4 4 4 2881
2 7 3 0 3 0 0
2 7 3 3 3 3 0
2 7 3 0 3 0 0
2 7 4 4 4 4 0
2 7 4 4 4 4 0
2 7 3 0 3 0 0
2 7 3 0 3 0 0
2 7 4 4 4 4 0
2 7 3 3 3 3 0
2 7 3 0 3 0 0
2 7 3 3 3 3 0
2 7 3 3 3 3 0
2 7 3 3 3 3 0
2 7 3 0 3 0 0
2 7 3 3 3 3 0
2 7 3 0 3 0 0
2 7 3 0 3 0 0
2 7 4 4 4 4 0
2 7 3 0 3 0 0
end
[/CODE]
Related Posts with Renaming the variables by parsing a string
kdensity of plausible values in PIAAC data using -repest-Hello, I am working with OECD's PIAAC data, a survey of skills of people in OECD countries. The dat…
Possible Issue with "nnmatch" in Stata 15Hello All (first post, be kind), I am running teffects nnmatch and noticed the the 'Matching Variab…
Decimal places control when exporting to tex file using logoutDear Statalists, I have a few numbers in my dta which I would like them to remain in this format (ro…
Boostrapping system of equationsHi, I am trying to bootstrap standard errors for a system of equations (its a 2SLS where I create th…
Date Variable problemHi I am new to Stata, I am finding problem in getting solution for my date variable that is string …
Subscribe to:
Post Comments (Atom)
0 Response to Renaming the variables by parsing a string
Post a Comment