diff --git a/do_files/next_steps-data_structures.do b/do_files/next_steps-data_structures.do index 0f01cfd..4f4ebb8 100644 --- a/do_files/next_steps-data_structures.do +++ b/do_files/next_steps-data_structures.do @@ -6,13 +6,11 @@ capture program drop negative_to_na program define negative_to_na syntax varlist(numeric) - foreach var of varlist `varlist' { - replace `var' = . if `var' < 0 - } + recode `varlist' (min/-1 = .) end use NSID W1alceverYP using "safeguarded_eul/wave_one_lsype_young_person_2020.dta", clear numlabel, add // Adds numeric values to value labels tabulate W1alceverYP, missing // Raw variable -negative_to_na W1alceverYP // Replaces negative values with missing (.) +negative_to_na W1alceverYP // Replaces values of -1 or below with missing (.) tabulate W1alceverYP, missing // Cleaned variable diff --git a/do_files/next_steps-merging_across_sweeps.do b/do_files/next_steps-merging_across_sweeps.do index 4f49c84..4c9d23a 100644 --- a/do_files/next_steps-merging_across_sweeps.do +++ b/do_files/next_steps-merging_across_sweeps.do @@ -99,9 +99,7 @@ capture program drop negative_to_na program define negative_to_na syntax varlist(numeric) - foreach var of varlist `varlist' { - replace `var' = . if `var' < 0 - } + recode `varlist' (min/-1 = .) end negative_to_na ghq12 diff --git a/do_files/next_steps-merging_within_sweep.do b/do_files/next_steps-merging_within_sweep.do index 8f5f7d4..0bad96d 100644 --- a/do_files/next_steps-merging_within_sweep.do +++ b/do_files/next_steps-merging_within_sweep.do @@ -46,4 +46,5 @@ merge 1:1 NSID using "df_tenure.dta", keep(master match) nogenerate merge 1:1 NSID using "df_nssec.dta", keep(master match) nogenerate merge 1:1 NSID using "df_mother_nssec.dta", keep(master match) nogenerate merge 1:1 NSID using "df_siblings.dta", keep(master match) nogenerate +set linesize 255 // Widens the output so that each row of the listing fits on one line list in 1/10