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
Problems calculating the change in vote share from incumbent candidates (electoral data)Hi all. I have a dataset with electoral municipal information for Brazilian municipalities from 2000…
model specification and implications of time invariant variables with mixedHi all, I've read through some other forum posts similar to this topic, but didn't think they were …
Reshaping Data for Analyzing Experiments with Fractional Factorial Designs Dear Stata community, I need to reshape/reorganize my data for analyzing the results of a survey e…
Logistic regression interactions testHello! I have a logistic regression model that keeps failing the goodness of fit test. The unweight…
Difficulty with Stata Manuals in SumatraPDFDear Statalist, I am having some trouble with the Stata manuals when using SumatraPDF (v3.2 64-bit …
Subscribe to:
Post Comments (Atom)
0 Response to Renaming the variables by parsing a string
Post a Comment