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
How to seperate numbers from a string variableI have a string variable that has labels and a number. I only need the number. How do I separate it …
Bilateral trade gravity model specificationDear community, I want to estimate a gravity model to examine the impact of interstate wars on bila…
Requesting feedback on set-up of a time to event analysis with Andersen Gill methodHi there, I would like to perform a time to event analysis of hospital readmissions by patient usin…
very large integers - precision beyond double storage typeHi there I understand that there are limits on the precision of storage types, with 'double' offerin…
Python Dictionary (I think) to dataframeHey everyone. To anyone who may use Python... A coworker and I wish to obtain some trade data from U…
Subscribe to:
Post Comments (Atom)
0 Response to Renaming the variables by parsing a string
Post a Comment