********************************************************************* * * * PROGRAM : LCH.SAS * * * * PROGRAMMER : Anne Maumary-Gremaud-Revised by * * Amy T. Cunningham 11/21/96 to conform with * * revised Variable names. * * * * PURPOSE : Create a SAS dataset containing derived * * variables from the PxCx datasets. * * Program can be modified to process PxCx data * * from any cohort from year 2 and over (the life * * changes measure is only used for year 2 and * * over of each cohort) by setting severals * * parameters at beginning of program. * * * * INPUT : pXc * * * * OUTPUT : SAS dataset containing the derived variables * * * * UPDATED: J. Godwin to run off aggregated unscored * * datasets. * * Original program had errors in * * scoring of lch&yr.wpr, lch&yr.dir, * * lch&yr.prg, and lch&yr.ppn. In addition, * * recoding of pXcDH65 was not complete and * * therefore created errors in LCH&yr.sls. * * * *********************************************************************; **Fill out information in next section; %let source=Parent; %let src=p; %let in=c; %let longname=lifechanges; %let scoredname=LCH; **Enter high-level path (e.g., l:\datasets) **; %let path=N:\datasets; **Enter year of data collection **; %let yr=10; **Enter variable which must be present to retain record (typically interviewer id) **; %let screen=intid; **Specify Lib for input datasets **; Libname SASIN "&path.\&source.\&longname.\U"; **Specify Lib for output datasets **; Libname SASOUT "&path.\&source.\&longname.\S"; **** DO NOT CHANGE PROGRAM BELOW THIS LINE; *create linsum macro; *The macro, "linsum" creates derived variables which are sums of input scale items. In the case of missing input items, the output variable is defined to be missing if half or more of the input items are missing. Otherwise, missing input items are replaced with the mean of the nonmissing items. The macro call to linsum specifies the input items as a string "var_list" of variable names, and specifies the label and name of the output variable as "var_name" and "var_labl" respectively. ; %macro linsum; data first; set &INDATA; count = 0; label &var_name = "&var_labl"; meanz = 0; array sumvars &var_list; array working &var_list count meanz &var_name; do i = 1 to dim(sumvars); if working(i) = . then count = count + 1; end; do i = 1 to 1; meanz = mean(of &var_list); end ; do i = 1 to dim(sumvars) ; if working(i) = . then working(i) = meanz ; end ; do i = 1 to 1 ; if count le .5*dim(sumvars) then &var_name = sum(of &var_list); else &var_name = . ; end ; keep site tcid &var_name; proc sort ; by site tcid ; data &INDATA ; merge first &INDATA ; by site tcid ; run; %mend linsum; *create linmean macro; %macro linmean; data first; set &INDATA; count = 0; label &var_name = "&var_labl"; meanz = 0; array sumvars &var_list; array working &var_list count meanz &var_name; do i = 1 to dim(sumvars); if working(i) = . then count = count + 1; end; do i = 1 to 1; meanz = mean(of &var_list); end ; do i = 1 to dim(sumvars) ; if working(i) = . then working(i) = meanz ; end ; do i = 1 to 1 ; if count le .5*dim(sumvars) then &var_name = sum(of &var_list)/dim(sumvars) ; else &var_name = . ; end ; keep site tcid &var_name ; proc sort ; by site tcid ; data &INDATA ; merge first &INDATA ; by site tcid ; run; %mend linmean; *create scoring macro; %macro score (yr2=); %let INDATA=sasout.&scoredname.&yr.; %if &yr2=1 %then %do; %let item = %str( P1CDH1 P1CDH2 P1CDH3 P1CDH4 P1CDH5 P1CDH6 P1CDH7 P1CDH8 P1CDH9 P1CDH10 P1CDH11 P1CDH12 P1CDH13 P1CDH14 P1CDH15 P1CDH16 P1CDH17 P1CDH18 P1CDH19 P1CDH20 P1CDH21 P1CDH22 P1CDH23 P1CDH24 P1CDH25 P1CDH26 P1CDH27 P1CDH28 P1CDH29 P1CDH30 P1CDH31 P1CDH32 P1CDH33 P1CDH34 P1CDH35 P1CDH36 P1CDH37 P1CDH38 P1CDH39 P1CDH40 P1CDH41 P1CDH42 P1CDH43 P1CDH44 P1CDH45 P1CDH46 P1CDH47 P1CDH48 P1CDH49 P1CDH50 P1CDH51 P1CDH52 P1CDH53 P1CDH54 P1CDH55 P1CDH56 P1CDH57 P1CDH58 P1CDH59 P1CDH60 P1CDH61 P1CDH62 P1CDH63 P1CDH64 P1CDH65 P1CDH66 P1CDH67 P1CDH68 P1CDH69 P1CFR1 P1CFR2 P1CFR3 P1CFR4 P1CFR5 P1CFR6 P1CIR5 P1CIR6 P1CIR7 P1CIR8 P1CPK1 P1CPK2 P1CPK3 P1CPK4 P1CPK5 P1CPK6 P1CPK7 P1CPK8 P1CPK9 P1CPK10 P1CPK11 P1CPK12 P1CPK13 P1CPK14 P1CPK15 P1CPK16 P1CPK17 P1CPK18 P1CPK19 P1CPK20 P1CPK21 P1CPK22 P1CPK23 P1CPK24 P1CPK25 P1CPK26 P1CPK27 P1CPK28 P1CPK29 P1CPK30 P1CPK31 P1CPK32 P1CPK33 P1CPK34 P1CPK35 P1CPK36 P1CPK37 P1CPK38 P1CPK39 P1CPK40 P1CPK41 P1CPK42 P1CPK43 P1CPK44 P1CPN1 P1CPN2 P1CPN3 P1CPN4 P1CPN5 P1CPR5 P1CPR6 P1CPR7 P1CPR8 P1CTR1 P1CTR2 P1CTR3 P1CTR4 P1CTR5 P1CTR6 P1CTR7 P1CTR8 P1CTR9 P1CTR10 P1CTR11 P1CTR12 P1CTR13 P1CTR14 P1CTR15 P1CTR16 P1CTR17 P1CTR18 P1CTR19 P1CTR20 P1CTR21 P1CTR22 P1CTR23 P1CTR24 P1CTR25 P1CTR26 P1CTR27 P1CTR28 P1CTR29 P1CTR30 P1CTR31 P1CTR32 P1CTR33 P1CTR34 P1CTR35 P1CTR36 P1CTR37 P1CTR38 P1CTR39 P1CTR40 P1CTR41 P1CTR42 P1CTR43 P1CTR44 P1CTR45 P1CTR46 P1CTR47 P1CTR48 P1C26OL P1C27OL P1C28OL P1C29OL P1C32OL P1C34OL P1C35OL P1C36OL P1C37OL P1C40OL P1C42OL P1C43OL P1C44OL P1C45OL P1C48OL P1C50OL P1C51OL P1C52OL P1C53OL P1C56OL P1C58OL P1C59OL P1C60OL P1C61OL P1C64OL P1C66OL P1C67OL P1C68OL P1C69OL P1C72OL P1C1 P1C2 P1C3 P1C4 P1C5 P1C6 P1C7 P1C8 P1C9 P1C10 P1C11 P1C12 P1C13 P1C14 P1C15 P1C16 P1C17 P1C18 P1C19 P1C20 P1C21 P1C22 P1C23 P1C24 P1C25 P1C31 P1C32 P1C33 P1C39 P1C40 P1C41 P1C47 P1C48 P1C49 P1C55 P1C56 P1C57 P1C63 P1C64 P1C65 P1C71 P1C72 P1C73 P1C74 P1C75 P1C76 P1C77 P1C78 P1C79 P1C80 ); data &INDATA; set &INDATA; array one[*] &item; do i=1 to dim(one); if one[i] in (8,9) then one[i] = "." ; end; drop i; array two[*] &src.&yr.CPK28 &src.&yr.CPK29 &src.&yr.CPK30 &src.&yr.CPK31 &src.&yr.CPK32 &src.&yr.CPK33 &src.&yr.CPK34 &src.&yr.CPK35 &src.&yr.CPK36 &src.&yr.CPK37 &src.&yr.CPK38 &src.&yr.CPK39 &src.&yr.CPK40 &src.&yr.CPK41 &src.&yr.CPK42 &src.&yr.CPK43; do i=1 to dim(two); if two[i] >2 then two[i] = "." ; end; drop i; if &src.&yr.CDH65 = 1 then &src.&yr.CDH65r = 1; if &src.&yr.CDH65 = 2 then &src.&yr.CDH65r = 2; if &src.&yr.CDH65 = 3 then &src.&yr.CDH65r = 3; if &src.&yr.CDH65 = 4 then &src.&yr.CDH65r = 4; if &src.&yr.CDH65 = 5 then &src.&yr.CDH65r = 5; if &src.&yr.CDH65 = 6 then &src.&yr.CDH65r = 5; if &src.&yr.CDH65 = 7 then &src.&yr.CDH65r = .; ** recode variable "average grade" ; ** 0=missing; if &src.&yr.CDH64 = 0 then &src.&yr.CDH64r = .; if &src.&yr.CDH64 ne 0 then &src.&yr.CDH64r = &src.&yr.CDH64; label &src.&yr.CDH65r = "Recoded-How far in school" &src.&yr.CDH64r = "Recoded-Grade Expected"; run; proc sort;by site tcid; ** Compute the derived variable of Quality of Parent-Child Relationship **; %let var_name = &scoredname.&yr.qpr ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Parent) ; %let var_list = %str(&src.&yr.C18 &src.&yr.C19R &src.&yr.C20 &src.&yr.C21) ; %linmean ; %let var_name = &scoredname.&yr.qob ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Observer) ; %let var_list = %str(&src.&yr.C22 &src.&yr.C23 &src.&yr.C24 &src.&yr.C25) ; %linmean ; ** Compute the derived variable of Stress Scale sum score for Kindergarden**; %let var_name = &scoredname.&yr.str ; %let var_labl = %str(Y&yr. Kindergarten Stress Scale sum score ) ; %let var_list = %str(&src.&yr.C1 &src.&yr.C2 &src.&yr.C3 &src.&yr.C4 &src.&yr.C5 &src.&yr.C6 &src.&yr.C7 &src.&yr.C8 &src.&yr.C9 &src.&yr.C10 &src.&yr.C11 &src.&yr.C12 &src.&yr.C13 &src.&yr.C14 &src.&yr.C15 &src.&yr.C16) ; %linsum ; ** Compute the derived variable of Stress Scale sum score for PK**; %let var_name = &scoredname.&yr.pks ; %let var_labl = %str(PK Stress Scale sum score ) ; %let var_list = %str(&src.&yr.CPK28 &src.&yr.CPK29 &src.&yr.CPK30 &src.&yr.CPK31 &src.&yr.CPK32 &src.&yr.CPK33 &src.&yr.CPK34 &src.&yr.CPK35 &src.&yr.CPK36 &src.&yr.CPK37 &src.&yr.CPK38 &src.&yr.CPK39 &src.&yr.CPK40 &src.&yr.CPK41 &src.&yr.CPK42 &src.&yr.CPK43) ; %linsum ; ** Compute the derived variables of Ignore, **; %let var_name = &scoredname.&yr.idn; %let var_labl = %str(Y&yr. LC Ignore/Do Nothing mean score) ; %let var_list = %str(P&yr.C26OL P&yr.C34OL P&yr.C42OL P&yr.C50OL P&yr.C58OL P&yr.C66OL) ; %linmean ; ** Compute the derived variables of Reasoning **; %let var_name = &scoredname.&yr.rsn; %let var_labl = %str(Y&yr. LC Reasoning mean score) ; %let var_list = %str(P&yr.C27OL P&yr.C35OL P&yr.C43OL P&yr.C51OL P&yr.C59OL P&yr.C67OL) ; %linmean ; ** Compute the derived variables of Inductive Reasoning**; %let var_name = &scoredname.&yr.irs; %let var_labl = %str(Y&yr. LC Inductive Reasoning mean score) ; %let var_list = %str(P&yr.C28OL P&yr.C36OL P&yr.C44OL P&yr.C52OL P&yr.C60OL P&yr.C68OL) ; %linmean ; ** Compute the derived variables of Verbal Punishment**; %let var_name = &scoredname.&yr.vpn; %let var_labl = %str(Y&yr. LC Verbal Punishment mean score) ; %let var_list = %str(P&yr.C29OL P&yr.C37OL P&yr.C45OL P&yr.C53OL P&yr.C61OL P&yr.C69OL) ; %linmean ; ** Compute the derived variables of Withdraw of Privileges**; %let var_name = &scoredname.&yr.wpr; %let var_labl = %str(Y&yr. LC Withdraw of Privileges mean score) ; %let var_list = %str(P&yr.C31 P&yr.C39 P&yr.C47 P&yr.C55 P&yr.C63 P&yr.C71) ; %linmean ; * Compute the derived variables of Directives**; %let var_name = &scoredname.&yr.dir; %let var_labl = %str(Y&yr. LC Directives mean score) ; %let var_list = %str(P&yr.C32 P&yr.C40 P&yr.C48 P&yr.C56 P&yr.C64 P&yr.C72) ; %linmean ; * Compute the derived variables of Proactive Guidance**; %let var_name = &scoredname.&yr.prg; %let var_labl = %str(Y&yr. LC Proactive Guidance mean score) ; %let var_list = %str(P&yr.C32OL P&yr.C40OL P&yr.C48OL P&yr.C56OL P&yr.C64OL P&yr.C72OL) ; %linmean ; * Compute the derived variables of Physical Punishment**; %let var_name = &scoredname.&yr.ppn; %let var_labl = %str(Y&yr. LC Physical Punishment mean score) ; %let var_list = %str(P&yr.C33 P&yr.C41 P&yr.C49 P&yr.C57 P&yr.C65 P&yr.C73) ; %linmean ; ** Compute the derived variable of Expected Success in Life and at School **; %let var_name = &scoredname.&yr.sls; %let var_labl = %str(Y&yr. LC School and Life Success mean score) ; %let var_list = %str(P&yr.CDH64r P&yr.CDH65r P&yr.CDH66 P&yr.CDH67) ; %linmean ; %end; %if &yr2=2 %then %do; %let item = %str( P2C1 P2C2 P2C3 P2C4 P2C5 P2C6 P2C7 P2C8 P2C9 P2C10 P2C11 P2C12 P2C13 P2C14 P2C15 P2C16 P2C17 P2C18 P2C19 P2C20 P2C21 P2C22 P2C23 P2C24 P2C25 P2C31 P2C32 P2C33 P2C39 P2C40 P2C41 P2C47 P2C48 P2C49 P2C55 P2C56 P2C57 P2C63 P2C64 P2C65 P2C71 P2C72 P2C73 P2C74 P2C76 P2C77 P2C79 P2C26OL P2C27OL P2C28OL P2C29OL P2C32OL P2C34OL P2C35OL P2C36OL P2C37OL P2C40OL P2C42OL P2C43OL P2C44OL P2C45OL P2C48OL P2C50OL P2C51OL P2C52OL P2C53OL P2C56OL P2C58OL P2C59OL P2C60OL P2C61OL P2C64OL P2C66OL P2C67OL P2C68OL P2C69OL P2C72OL P2CDH23 P2CDH24 P2CDH64 P2CDH65 P2CDH66 P2CDH67 P2CDH70 P2CDH68 P2CDH71 P2CFR1 P2CFR2 P2CFR3 P2CFR4 P2CFR5 P2CFR6 ); data &INDATA; set &INDATA; array four[*] &item; do i=1 to dim(four); if four[i] in (8,9) then four[i] = "." ; end; drop i; if &src.&yr.CDH65 = 1 then &src.&yr.CDH65r = 1; if &src.&yr.CDH65 = 2 then &src.&yr.CDH65r = 2; if &src.&yr.CDH65 = 3 then &src.&yr.CDH65r = 3; if &src.&yr.CDH65 = 4 then &src.&yr.CDH65r = 4; if &src.&yr.CDH65 = 5 then &src.&yr.CDH65r = 5; if &src.&yr.CDH65 = 6 then &src.&yr.CDH65r = 5; if &src.&yr.CDH65 = 7 then &src.&yr.CDH65r = .; ** recode variable "average grade" ; ** 0=missing; if &src.&yr.CDH64 = 0 then &src.&yr.CDH64r = .; if &src.&yr.CDH64 ne 0 then &src.&yr.CDH64r = &src.&yr.CDH64; label &src.&yr.CDH65r = "Recoded-How far in school" &src.&yr.CDH64r = "Recoded-Grade Expected"; run; proc sort ;by site tcid; ** Compute the derived variable of Quality of Parent-Child Relationship **; %let var_name = &scoredname.&yr.qpr ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Parent) ; %let var_list = %str(&src.&yr.C18 &src.&yr.C19R &src.&yr.C20 &src.&yr.C21) ; %linmean ; %let var_name = &scoredname.&yr.qob ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Observer) ; %let var_list = %str(&src.&yr.C22 &src.&yr.C23 &src.&yr.C24 &src.&yr.C25) ; %linmean ; ** Compute the derived variable of Stress Scale sum score **; %let var_name = &scoredname.&yr.str ; %let var_labl = %str(Y&yr. LC Stress Scale sum score ) ; %let var_list = %str(&src.&yr.C1 &src.&yr.C2 &src.&yr.C3 &src.&yr.C4 &src.&yr.C5 &src.&yr.C6 &src.&yr.C7 &src.&yr.C8 &src.&yr.C9 &src.&yr.C10 &src.&yr.C11 &src.&yr.C12 &src.&yr.C13 &src.&yr.C14 &src.&yr.C15 &src.&yr.C16) ; %linsum ; ** Compute the derived variables of Ignore, **; %let var_name = &scoredname.&yr.idn; %let var_labl = %str(Y&yr. LC Ignore/Do Nothing mean score) ; %let var_list = %str(P&yr.C26OL P&yr.C34OL P&yr.C42OL P&yr.C50OL P&yr.C58OL P&yr.C66OL) ; %linmean ; ** Compute the derived variables of Reasoning **; %let var_name = &scoredname.&yr.rsn; %let var_labl = %str(Y&yr. LC Reasoning mean score) ; %let var_list = %str(P&yr.C27OL P&yr.C35OL P&yr.C43OL P&yr.C51OL P&yr.C59OL P&yr.C67OL) ; %linmean ; ** Compute the derived variables of Inductive Reasoning**; %let var_name = &scoredname.&yr.irs; %let var_labl = %str(Y&yr. LC Inductive Reasoning mean score) ; %let var_list = %str(P&yr.C28OL P&yr.C36OL P&yr.C44OL P&yr.C52OL P&yr.C60OL P&yr.C68OL) ; %linmean ; ** Compute the derived variables of Verbal Punishment**; %let var_name = &scoredname.&yr.vpn; %let var_labl = %str(Y&yr. LC Verbal Punishment mean score) ; %let var_list = %str(P&yr.C29OL P&yr.C37OL P&yr.C45OL P&yr.C53OL P&yr.C61OL P&yr.C69OL) ; %linmean ; ** Compute the derived variables of Withdraw of Privileges**; %let var_name = &scoredname.&yr.wpr; %let var_labl = %str(Y&yr. LC Withdraw of Privileges mean score) ; %let var_list = %str(P&yr.C31 P&yr.C39 P&yr.C47 P&yr.C55 P&yr.C63 P&yr.C71) ; %linmean ; * Compute the derived variables of Directives**; %let var_name = &scoredname.&yr.dir; %let var_labl = %str(Y&yr. LC Directives mean score) ; %let var_list = %str(P&yr.C32 P&yr.C40 P&yr.C48 P&yr.C56 P&yr.C64 P&yr.C72) ; %linmean ; * Compute the derived variables of Proactive Guidance**; %let var_name = &scoredname.&yr.prg; %let var_labl = %str(Y&yr. LC Proactive Guidance mean score) ; %let var_list = %str(P&yr.C32OL P&yr.C40OL P&yr.C48OL P&yr.C56OL P&yr.C64OL P&yr.C72OL) ; %linmean ; * Compute the derived variables of Physical Punishment**; %let var_name = &scoredname.&yr.ppn; %let var_labl = %str(Y&yr. LC Physical Punishment mean score) ; %let var_list = %str(P&yr.C33 P&yr.C41 P&yr.C49 P&yr.C57 P&yr.C65 P&yr.C73) ; %linmean ; ** Compute the derived variable of Expected Success in Life and at School **; %let var_name = &scoredname.&yr.sls; %let var_labl = %str(Y&yr. LC School and Life Success mean score) ; %let var_list = %str(P&yr.CDH64r P&yr.CDH65r P&yr.CDH66 P&yr.CDH67) ; %linmean ; %end; %if &yr2=3 %then %do; %let item = %str( P3C1 P3C2 P3C3 P3C4 P3C5 P3C6 P3C7 P3C8 P3C9 P3C10 P3C11 P3C12 P3C13 P3C14 P3C15 P3C16 P3C17 P3C18 P3C19 P3C20 P3C21 P3C22 P3C23 P3C24 P3C25 P3C31 P3C32 P3C33 P3C39 P3C40 P3C41 P3C47 P3C48 P3C49 P3C55 P3C56 P3C57 P3C63 P3C64 P3C65 P3C71 P3C72 P3C73 P3C74 P3C75 P3C76 P3C77 P3C78 P3C79 P3C80 P3C26OL P3C27OL P3C28OL P3C29OL P3C32OL P3C34OL P3C35OL P3C36OL P3C37OL P3C40OL P3C42OL P3C43OL P3C44OL P3C45OL P3C48OL P3C50OL P3C51OL P3C52OL P3C53OL P3C56OL P3C58OL P3C59OL P3C60OL P3C61OL P3C64OL P3C66OL P3C67OL P3C68OL P3C69OL P3C72OL ); data &INDATA; set &INDATA; array five[*] &item; do i=1 to dim(five); if five[i] in (8,9) then five[i] = "." ; end; drop i; run; proc sort ;by site tcid; ** Compute the derived variable of Quality of Parent-Child Relationship **; %let var_name = &scoredname.&yr.qpr ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Parent) ; %let var_list = %str(&src.&yr.C18 &src.&yr.C19R &src.&yr.C20 &src.&yr.C21) ; %linmean ; %let var_name = &scoredname.&yr.qob ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Observer) ; %let var_list = %str(&src.&yr.C22 &src.&yr.C23 &src.&yr.C24 &src.&yr.C25) ; %linmean ; ** Compute the derived variable of Stress Scale sum score **; %let var_name = &scoredname.&yr.str ; %let var_labl = %str(Y&yr. LC Stress Scale sum score ) ; %let var_list = %str(&src.&yr.C1 &src.&yr.C2 &src.&yr.C3 &src.&yr.C4 &src.&yr.C5 &src.&yr.C6 &src.&yr.C7 &src.&yr.C8 &src.&yr.C9 &src.&yr.C10 &src.&yr.C11 &src.&yr.C12 &src.&yr.C13 &src.&yr.C14 &src.&yr.C15 &src.&yr.C16) ; %linsum ; ** Compute the derived variables of Ignore, **; %let var_name = &scoredname.&yr.idn; %let var_labl = %str(Y&yr. LC Ignore/Do Nothing mean score) ; %let var_list = %str(P&yr.C26OL P&yr.C34OL P&yr.C42OL P&yr.C50OL P&yr.C58OL P&yr.C66OL) ; %linmean ; ** Compute the derived variables of Reasoning **; %let var_name = &scoredname.&yr.rsn; %let var_labl = %str(Y&yr. LC Reasoning mean score) ; %let var_list = %str(P&yr.C27OL P&yr.C35OL P&yr.C43OL P&yr.C51OL P&yr.C59OL P&yr.C67OL) ; %linmean ; ** Compute the derived variables of Inductive Reasoning**; %let var_name = &scoredname.&yr.irs; %let var_labl = %str(Y&yr. LC Inductive Reasoning mean score) ; %let var_list = %str(P&yr.C28OL P&yr.C36OL P&yr.C44OL P&yr.C52OL P&yr.C60OL P&yr.C68OL) ; %linmean ; ** Compute the derived variables of Verbal Punishment**; %let var_name = &scoredname.&yr.vpn; %let var_labl = %str(Y&yr. LC Verbal Punishment mean score) ; %let var_list = %str(P&yr.C29OL P&yr.C37OL P&yr.C45OL P&yr.C53OL P&yr.C61OL P&yr.C69OL) ; %linmean ; ** Compute the derived variables of Withdraw of Privileges**; %let var_name = &scoredname.&yr.wpr; %let var_labl = %str(Y&yr. LC Withdraw of Privileges mean score) ; %let var_list = %str(P&yr.C31 P&yr.C39 P&yr.C47 P&yr.C55 P&yr.C63 P&yr.C71) ; %linmean ; * Compute the derived variables of Directives**; %let var_name = &scoredname.&yr.dir; %let var_labl = %str(Y&yr. LC Directives mean score) ; %let var_list = %str(P&yr.C32 P&yr.C40 P&yr.C48 P&yr.C56 P&yr.C64 P&yr.C72) ; %linmean ; * Compute the derived variables of Proactive Guidance**; %let var_name = &scoredname.&yr.prg; %let var_labl = %str(Y&yr. LC Proactive Guidance mean score) ; %let var_list = %str(P&yr.C32OL P&yr.C40OL P&yr.C48OL P&yr.C56OL P&yr.C64OL P&yr.C72OL) ; %linmean ; * Compute the derived variables of Physical Punishment**; %let var_name = &scoredname.&yr.ppn; %let var_labl = %str(Y&yr. LC Physical Punishment mean score) ; %let var_list = %str(P&yr.C33 P&yr.C41 P&yr.C49 P&yr.C57 P&yr.C65 P&yr.C73) ; %linmean ; %end; %if &yr2 =4 %then %do; data &INDATA; set &INDATA; array six[*] P&yr.C1-P&yr.C80; do i=1 to dim(six); if six[i] in (8,9) then six[i] = "." ; end; drop i; run; proc sort; by site tcid; ** Compute the derived variable of Quality of Parent-Child Relationship **; %let var_name = &scoredname.&yr.qpr ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Parent) ; %let var_list = %str(&src.&yr.C18 &src.&yr.C19R &src.&yr.C20 &src.&yr.C21) ; %linmean ; %let var_name = &scoredname.&yr.qob ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Observer) ; %let var_list = %str(&src.&yr.C22 &src.&yr.C23 &src.&yr.C24 &src.&yr.C25) ; %linmean ; ** Compute the derived variable of Stress Scale sum score **; %let var_name = &scoredname.&yr.str ; %let var_labl = %str(Y&yr. LC Stress Scale sum score ) ; %let var_list = %str(&src.&yr.C1 &src.&yr.C2 &src.&yr.C3 &src.&yr.C4 &src.&yr.C5 &src.&yr.C6 &src.&yr.C7 &src.&yr.C8 &src.&yr.C9 &src.&yr.C10 &src.&yr.C11 &src.&yr.C12 &src.&yr.C13 &src.&yr.C14 &src.&yr.C15 &src.&yr.C16) ; %linsum ; ** Compute the derived variables of Contingent Ignoring **; %let var_name = &scoredname.&yr.cig; %let var_labl = %str(Y&yr. Contingent Ignoring Mean score) ; %let var_list = %str(P&yr.C26 P&yr.C34 P&yr.C42 P&yr.C50 P&yr.C58 P&yr.C66) ; %linmean ; ** Compute the derived variables of Do Nothing **; %let var_name = &scoredname.&yr.dnt; %let var_labl = %str(Y&yr. Do Nothing mean score) ; %let var_list = %str(P&yr.C27 P&yr.C35 P&yr.C43 P&yr.C51 P&yr.C59 P&yr.C67) ; %linmean ; ** Compute the derived variables of Inductive Reasoning/Proactive Guid.**; %let var_name = &scoredname.&yr.rpg; %let var_labl = %str(Y&yr. Reason/Inductive/Proactive Guid. mean score) ; %let var_list = %str(P&yr.C28 P&yr.C36 P&yr.C44 P&yr.C52 P&yr.C60 P&yr.C68) ; %linmean ; ** Compute the derived variables of Approp. Verbal Punishment**; %let var_name = &scoredname.&yr.acv; %let var_labl = %str(Y&yr. Approp. Verbal Correction mean score) ; %let var_list = %str(P&yr.C29 P&yr.C37 P&yr.C45 P&yr.C53 P&yr.C61 P&yr.C69) ; %linmean ; ** Compute the derived variables of Inapprop. Verbal Correction **; %let var_name = &scoredname.&yr.ivc; %let var_labl = %str(Y&yr. Inapprop. Verbal Correction mean score) ; %let var_list = %str(P&yr.C30 P&yr.C38 P&yr.C46 P&yr.C54 P&yr.C62 P&yr.C70) ; %linmean ; ** Compute the derived variables of Withdraw of Privileges**; %let var_name = &scoredname.&yr.wpr; %let var_labl = %str(Y&yr. Withdraw of Privileges mean score) ; %let var_list = %str(P&yr.C31 P&yr.C39 P&yr.C47 P&yr.C55 P&yr.C63 P&yr.C71) ; %linmean ; * Compute the derived variables of Directives**; %let var_name = &scoredname.&yr.dir; %let var_labl = %str(Y&yr. Directives mean score) ; %let var_list = %str(P&yr.C32 P&yr.C40 P&yr.C48 P&yr.C56 P&yr.C64 P&yr.C72) ; %linmean ; * Compute the derived variables of Physical Punishment**; %let var_name = &scoredname.&yr.ppn; %let var_labl = %str(Y&yr. LC Physical Punishment mean score) ; %let var_list = %str(P&yr.C33 P&yr.C41 P&yr.C49 P&yr.C57 P&yr.C65 P&yr.C73) ; %linmean ; %end; %if &yr2>4 and &yr2<8 %then %do; data &INDATA; set &INDATA; array seven[*] P&yr.C1-P&yr.C25 P&yr.C74-P&yr.C80; do i=1 to dim(seven); if seven[i] in (8,9) then seven[i] = "." ; end; drop i; n_P&yr.C1=input(P&yr.C1,1.); n_P&yr.C2=input(P&yr.C2,1.); n_P&yr.C3=input(P&yr.C3,1.); n_P&yr.C4=input(P&yr.C4,1.); n_P&yr.C5=input(P&yr.C5,1.); n_P&yr.C6=input(P&yr.C6,1.); n_P&yr.C7=input(P&yr.C7,1.); n_P&yr.C8=input(P&yr.C8,1.); n_P&yr.C9=input(P&yr.C9,1.); n_P&yr.C10=input(P&yr.C10,1.); n_P&yr.C11=input(P&yr.C11,1.); n_P&yr.C12=input(P&yr.C12,1.); n_P&yr.C13=input(P&yr.C13,1.); n_P&yr.C14=input(P&yr.C14,1.); n_P&yr.C15=input(P&yr.C15,1.); n_P&yr.C16=input(P&yr.C16,1.); n_P&yr.C17=input(P&yr.C17,1.); n_P&yr.C18=input(P&yr.C18,1.); n_P&yr.C19=input(P&yr.C19,1.); n_P&yr.C20=input(P&yr.C20,1.); n_P&yr.C21=input(P&yr.C21,1.); n_P&yr.C22=input(P&yr.C22,1.); n_P&yr.C23=input(P&yr.C23,1.); n_P&yr.C24=input(P&yr.C24,1.); n_P&yr.C25=input(P&yr.C25,1.); n_P&yr.C74=input(P&yr.C74,1.); n_P&yr.C75=input(P&yr.C75,1.); n_P&yr.C76=input(P&yr.C76,1.); n_P&yr.C77=input(P&yr.C77,1.); n_P&yr.C78=input(P&yr.C78,1.); n_P&yr.C79=input(P&yr.C79,1.); n_P&yr.C80=input(P&yr.C80,1.); drop P&yr.C1-P&yr.C80 P&yr.CDH64-P&yr.CDH67 p&yr.CDH65r p&yr.CDH64r; run; data &INDATA; set &INDATA; rename n_P&yr.C1=P&yr.C1 n_P&yr.C2=P&yr.C2 n_P&yr.C3=P&yr.C3 n_P&yr.C4=P&yr.C4 n_P&yr.C5=P&yr.C5 n_P&yr.C6=P&yr.C6 n_P&yr.C7=P&yr.C7 n_P&yr.C8=P&yr.C8 n_P&yr.C9=P&yr.C9 n_P&yr.C10=P&yr.C10 n_P&yr.C11=P&yr.C11 n_P&yr.C12=P&yr.C12 n_P&yr.C13=P&yr.C13 n_P&yr.C14=P&yr.C14 n_P&yr.C15=P&yr.C15 n_P&yr.C16=P&yr.C16 n_P&yr.C17=P&yr.C17 n_P&yr.C18=P&yr.C18 n_P&yr.C19=P&yr.C19 n_P&yr.C20=P&yr.C20 n_P&yr.C21=P&yr.C21 n_P&yr.C22=P&yr.C22 n_P&yr.C23=P&yr.C23 n_P&yr.C24=P&yr.C24 n_P&yr.C25=P&yr.C25 n_P&yr.C74=P&yr.C74 n_P&yr.C75=P&yr.C75 n_P&yr.C76=P&yr.C76 n_P&yr.C77=P&yr.C77 n_P&yr.C78=P&yr.C78 n_P&yr.C79=P&yr.C79 n_P&yr.C80=P&yr.C80 ; run; data &INDATA; set &INDATA; label P&yr.C1 = "Changes: moved/major remodeling" P&yr.C2 = "Changes: medical problems w/TC" P&yr.C3 = "Changes: medical problems w/family" P&yr.C4 = "Changes: death of important person" P&yr.C5 = "Changes: divorce of TC's parents" P&yr.C6 = "Changes: separation of TC's parents" P&yr.C7 = "Changes: remarriage/reconciliation" P&yr.C8 = "Changes: parent/child separation" P&yr.C9 = "Changes: financial problems" P&yr.C10 = "Changes: legal problems" P&yr.C11 = "Changes: drug/alcohol use" P&yr.C12 = "Changes: stress/conflicts" P&yr.C13 = "Changes: pregnancies/miscarriages" P&yr.C14 = "Changes: job-related stress" P&yr.C15 = "Changes: loss of job" P&yr.C16 = "Changes: other" P&yr.C17 = "TC: reaction to changes" P&yr.C18 = "p-rating #1: satisfaction w/parent role" P&yr.C19 = "p-rating #2: child difficulty" P&yr.C20 = "p-rating #3: parent-child relationship" P&yr.C21 = "p-rating #4: satisfaction child behav" P&yr.C22 = "i-rating #1: parent description of TC" P&yr.C23 = "i-rating #2: parent insight about TC" P&yr.C24 = "i-rating #3: parent affect" P&yr.C25 = "i-rating #4: parent-child relationship" P&yr.C74 = "TC receive Tx for emot. diff." P&yr.C75 = "Type of Tx facility-TC" P&yr.C76 = "TC receive Rx for behav./attn. prob." P&yr.C77 = " Respondent receive Tx" P&yr.C78 = "Type of Tx facility-Respondent" P&yr.C79 = "Others in family receive Tx" P&yr.C80 = "Which other family-Tx"; run; proc sort;by site tcid; ** Compute the derived variable of Quality of Parent-Child Relationship **; %let var_name = &scoredname.&yr.qpr ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Parent) ; %let var_list = %str(&src.&yr.C18 &src.&yr.C19R &src.&yr.C20 &src.&yr.C21) ; %linmean ; %let var_name = &scoredname.&yr.qob ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Observer) ; %let var_list = %str(&src.&yr.C22 &src.&yr.C23 &src.&yr.C24 &src.&yr.C25) ; %linmean ; ** Compute the derived variable of Stress Scale sum score **; %let var_name = &scoredname.&yr.str ; %let var_labl = %str(Y&yr. LC Stress Scale sum score ) ; %let var_list = %str(&src.&yr.C1 &src.&yr.C2 &src.&yr.C3 &src.&yr.C4 &src.&yr.C5 &src.&yr.C6 &src.&yr.C7 &src.&yr.C8 &src.&yr.C9 &src.&yr.C10 &src.&yr.C11 &src.&yr.C12 &src.&yr.C13 &src.&yr.C14 &src.&yr.C15 &src.&yr.C16) ; %linsum ; %end; %if &yr2>7 %then %do; data &INDATA; set &INDATA; array seven[*] P&yr.C1-P&yr.C25 P&yr.C74-P&yr.C80; do i=1 to dim(seven); if seven[i] in (8,9) then seven[i] = "." ; end; drop i; run; proc sort;by site tcid;run; ** Compute the derived variable of Quality of Parent-Child Relationship **; %let var_name = &scoredname.&yr.qpr ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Parent) ; %let var_list = %str(&src.&yr.C18 &src.&yr.C19R &src.&yr.C20 &src.&yr.C21) ; %linmean ; %let var_name = &scoredname.&yr.qob ; %let var_labl = %str(Y&yr. LC Quality Parent-Child Relat_Observer) ; %let var_list = %str(&src.&yr.C22 &src.&yr.C23 &src.&yr.C24 &src.&yr.C25) ; %linmean ; ** Compute the derived variable of Stress Scale sum score **; %let var_name = &scoredname.&yr.str ; %let var_labl = %str(Y&yr. LC Stress Scale sum score ) ; %let var_list = %str(&src.&yr.C1 &src.&yr.C2 &src.&yr.C3 &src.&yr.C4 &src.&yr.C5 &src.&yr.C6 &src.&yr.C7 &src.&yr.C8 &src.&yr.C9 &src.&yr.C10 &src.&yr.C11 &src.&yr.C12 &src.&yr.C13 &src.&yr.C14 &src.&yr.C15 &src.&yr.C16) ; %linsum ; %end; %mend; data sasout.&scoredname.&yr.; set sasin.&src.&yr.&in.; ** Recoding of the variable "Parent Rating # 2" for consistency **; if &src.&yr.C19=1 then &src.&yr.C19R=5; if &src.&yr.C19=2 then &src.&yr.C19R=4; if &src.&yr.C19=3 then &src.&yr.C19R=3; if &src.&yr.C19=4 then &src.&yr.C19R=2; if &src.&yr.C19=5 then &src.&yr.C19R=1; label &src.&yr.C19R = "Recoded-Perception of TC difficulty"; run; proc sort; by site tcid;run; %score (yr2=&yr);