/* This propgram creates new measures based on existing GSS variables. Three of them --sexfreq1, reliten1, and attend1--are, more or less, continuous measurements. Note the use of local macros and an extended function to capture an existing variable label and then assign it to the new variables. See -help local- for details. */ capture log close log using "SOCY699C-HW4-REGRESS-SETUP.txt", text replace /* Create continuous measures */ #delimit ; capture drop sexfrq; local vlabel : variable label sexfreq; recode sexfreq (0= 0) (1= 2) (2= 12) (3= 30) (4= 52) (5=156) (6=208), gen(sexfrq); label variable sexfrq "`vlabel'"; capture drop attend1; local vlabel : variable label attend; recode attend (0= 0) (1= 0.5) (2= 1) (3= 6) (4= 12) (5= 30) (6= 45) (7= 52) (8= 59), gen(attend1); label variable attend1 "`vlabel'"; capture drop reliten1; local vlabel : variable label reliten; recode reliten (1= 1 "strong") (2= 3 "not very strong") (3= 2 "somewhat strong") (4= 4 "no religion"), gen(reliten1); label variable reliten1 "`vlabel'"; #delimit cr log close