---------------------------------------------------------------------------------------------------------------------------------- name: log: C:\Users\rwr\Dropbox\basu-house\build\code\../temp/raw2dta_DATE_OF_BIRTH.log log type: text opened on: 17 Jul 2016, 12:11:59 . /*****************************************************************************/ > clear all; . infile using `raw'`prg'.dct; infile dictionary { R0000100 "ID# (1-12686) 79" R0000300 "DATE OF BIRTH - MONTH 79" R0000500 "DATE OF BIRTH - YR 79" R0214700 "RACL/ETHNIC COHORT /SCRNR 79" R0214800 "SEX OF R 79" } (12,686 observations read) . #delimit cr delimiter now cr . do `raw'`prg'-value-labels.do . label define vlR0000300 0 "0: < 1" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "10" 11 "11" 12 "12" > 13 "13" 14 "14" 15 "15" 16 "16" . label values R0000300 vlR0000300 . label define vlR0000500 57 "57" 58 "58" 59 "59" 60 "60" 61 "61" 62 "62" 63 "63" 64 "64" 65 "65" 66 "66" 67 "67" 68 > "68" 69 "69" 70 "70" 71 "71" 72 "72" . label values R0000500 vlR0000500 . label define vlR0214700 1 "HISPANIC" 2 "BLACK" 3 "NON-BLACK, NON-HISPANIC" . label values R0214700 vlR0214700 . label define vlR0214800 1 "MALE" 2 "FEMALE" . label values R0214800 vlR0214800 . /* Crosswalk for Reference number & Question name > * Uncomment and edit this RENAME statement to rename variables for ease of use. > * This command does not guarantee uniqueness > */ . /* *start* */ . /* > rename R0000100 CASEID_1979 > rename R0000300 Q1_3_A_M_1979 // Q1-3_A~M > rename R0000500 Q1_3_A_Y_1979 // Q1-3_A~Y > rename R0214700 SAMPLE_RACE_1979 > rename R0214800 SAMPLE_SEX_1979 > */ . /* *end* */ . /* To convert variable names to lower case use the TOLOWER command > * (type findit tolower and follow the links to install). > * TOLOWER VARLIST will change listed variables to lower case; > * TOLOWER without a specified variable list will convert all variables in the dataset to lower case > */ . /* tolower */ . end of do-file . #delimit ; delimiter now ; . rename R0000100 id; . rename R0214800 sex; . rename R0214700 race; . keep if sex=="MALE":vlR0214800; (6,283 observations deleted) . gen birth_month = int(R0000300); . gen birth_year = int(R0000500); . replace birth_year = birth_year + 1900; (6,403 real changes made) . gen dob = ym(birth_year,birth_month); . format dob %tm; . keep id race sex dob birth_year birth_month; . save `tempdata'`prg'_data, replace; (note: file ../temp/DATE_OF_BIRTH_data.dta not found) file ../temp/DATE_OF_BIRTH_data.dta saved . end of do-file . do raw2dta_HGCREV.do; . /********************************************************************* > Program: raw2dta_HGCREV.do > Purpose: refers to variable name in NLSY79 data. > > Date Started: 21 Dec 2015 > Date Revised: 14 Jul 2016 > *********************************************************************/ . #delimit ; delimiter now ; . clear all; . set mo off; . set scheme s1color; . capture log close;