* Program: hre.sas ; * Created by: Jennifer Godwin (5/26/04) ; * Input: cXbd ; * Output: hreX ; libname sasin "l:\cohort 1\grade 11\child interview"; libname sasout "h:\work\hre"; %let yr=12; %let type=hre; %let inst=bd; %let coh=1; *when calculating the mean; %macro linmean; data &INDATA; set &INDATA; label &var_name = "&var_labl"; array sumvars {*} &var_list; if n(of sumvars(*))>=.5*dim(sumvars) then &var_name=mean(of sumvars(*)); proc sort; by site tcid; run; %mend linmean; *when calculating the sum; %macro linsum; data &INDATA; set &INDATA; label &var_name = "&var_labl"; array sumvars {*} &var_list; if n(of sumvars(*))>=.5*dim(sumvars) then &var_name=mean(of sumvars(*))*dim(sumvars); proc sort; by site tcid; run; %mend linsum; *data sasout.&type.&yr; data one; set sasin.dc&yr.&inst.&coh. sasin.nc&yr.&inst.&coh. sasin.pc&yr.&inst.&coh. sasin.sc&yr.&inst.&coh.; run; %macro recode (num=,x=, a=,b=,c=,d=); data &indata.; set &indata.; array &num._old (4) C&yr.BD&a. C&yr.BD&b. C&yr.BD&c. C&yr.BD&d. ; array &num._new (4) C&yr.BD&a.r C&yr.BD&b.r C&yr.BD&c.r C&yr.BD&d.r ; do i=1 to 4; if C&yr.BD&x. in (.r,.n,.s) then &num._new(i)=.; if C&yr.BD&x. = 0 then &num._new(i)=0; if C&yr.BD&x. = 1 then &num._new(i)=&num._old(i)+1; end; run; %mend; %let indata= one; %recode (num=one, x=5 , a=6 , b=7, c=8, d=9); %recode (num=two, x=10 , a=11 , b=12, c=13, d=14); %recode (num=three, x=15 , a=16 , b=17, c=18, d=19); %recode (num=four, x=20 , a=21 , b=22, c=23, d=24); %recode (num=five, x=25 , a=26 , b=27, c=28, d=29); %recode (num=six, x=30 , a=31 , b=32, c=33, d=34); data &indata.; set &indata.; label C&yr.BD6r= "Recoded-I cannot change other's views so why try" C&yr.BD7r= "Recoded-I'll work harder so the teacher will give a good grade" C&yr.BD8r= "Recoded-I'm smart so I'll do what I should and prove them wrong" C&yr.BD9r= "Recoded-I won't let others look down on me. I will stand up for myself" C&yr.BD11r= "Recoded-There's nothing I can do about it" C&yr.BD12r= "Recoded-I won't do anything that looks suspicious so they might leave me alone" C&yr.BD13r= "Recoded-I know I don't do anything wrong so I won't worry about it" C&yr.BD14r= "Recoded-I will confront them and tell them to treat me fairly" C&yr.BD16r= "Recoded-There's nothing I can do about it" C&yr.BD17r= "Recoded-I will do the best that I can and I will be treated fairly" C&yr.BD18r= "Recoded-I know I am good in this area. I won't let it get to me" C&yr.BD19r= "Recoded-I will stand up and demand that they give me a fair chance" C&yr.BD21r= "Recoded-There's nothing I can do" C&yr.BD22r= "Recoded-I will be proud to do the best that I can" C&yr.BD23r= "Recoded-I know I can work extra hard and it will help me be more successful" C&yr.BD24r= "Recoded-I will stand up for myself and not let others take advantage of me" C&yr.BD26r= "Recoded-There's nothing I can do about it" C&yr.BD27r= "Recoded-I won't do anything that looks suspicious and they might leave me alone" C&yr.BD28r= "Recoded-I know I am not a thief so I won't pay them any mind" C&yr.BD29r= "Recoded-I will confront them and tell them to leave me alone" C&yr.BD31r= "Recoded-I would do what they told me and be polite" C&yr.BD32r= "Recoded-I would not do anything suspicious in public so they won't harass me" C&yr.BD33r= "Recoded-I know I'm not a criminal but I will keep my cool" C&yr.BD34r= "Recoded-I would stand up for myself and refuse to let them harass me" ; run; %let var_name = HRE&yr.COP; %let var_labl = %str(HRE-Prevalence of Conversations Yr&yr.) ; %let var_list = %str(C&yr.BD5 C&yr.BD10 C&yr.BD15 C&yr.BD20 C&yr.BD25 C&yr.BD30); %linsum ; %let var_name = HRE&yr.SBS; %let var_labl = %str(HRE-Submissive Coping Style Yr&yr.) ; %let var_list = %str(C&yr.BD6r C&yr.BD11r C&yr.BD16r C&yr.BD21r C&yr.BD26r C&yr.BD31r); %linmean ; %let var_name = HRE&yr.AAC; %let var_labl = %str(HRE-Active Avoidance Coping Style Yr&yr.) ; %let var_list = %str(C&yr.BD7r C&yr.BD12r C&yr.BD17r C&yr.BD22r C&yr.BD27r C&yr.BD32r); %linmean; %let var_name = HRE&yr.CRC; %let var_labl = %str(HRE-Contextualized, Reality Based Agentic Coping Style Yr&yr.) ; %let var_list = %str(C&yr.BD8r C&yr.BD13r C&yr.BD18r C&yr.BD23r C&yr.BD28r C&yr.BD33r); %linmean; %let var_name = HRE&yr.SAC; %let var_labl = %str(HRE-Self-Assertion Coping Style Yr&yr.) ; %let var_list = %str(C&yr.BD9r C&yr.BD14r C&yr.BD19r C&yr.BD24r C&yr.BD29r C&yr.BD34r); %linmean; data sasout.hre&yr.; set one; drop i; run; proc contents; run; proc freq; table HRE&yr.COP HRE&yr.AAC HRE&yr.SBS HRE&yr.CRC HRE&yr.SAC; run;