I have 29 .csv dataset, each dataset is for a year from 1990 to 2018, and I want to append all datasets. Non of the datasets specify the year, so I need to generate variable year for each dataset before appending. Also, each datasets have its own do file for creating value and variable labels. Before appending datasets, I first opened .csv dataset for year 1990 in Stata 16, generated the variable year=1990, ran the do file for value labels and then save it as .dta file under the name c_1990.dta. I did the same procedure for each year, so that I have 29 files with name c_`year'.
After creating these file, I used the following command for appending.
Code:
use c_2018 forval x = 1990/2017 { append using c_`x' }
Code:
clear input float year long cipcode 1990 50.0000 1990 47.0000-Mechanics and Repairers, General 1990 27.0000 1990 15.0000-Engineering Technology, General 1990 99.0000 2003 54.0101-History, General 2003 13.0488 2003 14.0301-Agricultural Engineering 2003 50.0799-Fine Arts and Art Studies, Other 2003 99 -Grand total 2018 43.0199-Corrections and Criminal Justice, Other 2018 05.0201-African-American/Black Studies 2018 50.0501-Drama and Dramatics/Theatre Arts, General 2018 99 -Grand total end
Marjan
0 Response to value labels after appending datasets
Post a Comment