* Program: gag.sas ; * Created by: Jennifer Godwin (3/24/04) ; * Input: cXw ; * Output: gagX ; libname sasin "N:\Datasets\Child\gunsandgangschild\U"; libname sasout "N:\Datasets\Child\gunsandgangschild\S"; %let yr=9; %let type=gag; %let inst=W; data sasout.&type.&yr; set sasin.c&yr.&inst.; array orig c&yr.&inst.2c c&yr.&inst.2d c&yr.&inst.2e c&yr.&inst.3c c&yr.&inst.3d c&yr.&inst.3e c&yr.&inst.4d c&yr.&inst.4e c&yr.&inst.4f c&yr.&inst.5c c&yr.&inst.5d c&yr.&inst.5e c&yr.&inst.2b c&yr.&inst.3b c&yr.&inst.5b; array new C&yr.&inst.2Cr C&yr.&inst.2Dr C&yr.&inst.2Er C&yr.&inst.3Cr C&yr.&inst.3Dr C&yr.&inst.3Er C&yr.&inst.4Dr C&yr.&inst.4Er C&yr.&inst.4Fr C&yr.&inst.5Cr C&yr.&inst.5Dr C&yr.&inst.5Er C&yr.&inst.2Br C&yr.&inst.3Br C&yr.&inst.5Br; do i=1 to 15; new(i)=orig(i); end; *recode missings for weapon variables; if c&yr.&inst.2a=0 then do; c&yr.&inst.2cr=0; c&yr.&inst.2dr=0; c&yr.&inst.2er=0; end; if c&yr.&inst.3a=0 then do; c&yr.&inst.3cr=0; c&yr.&inst.3dr=0; c&yr.&inst.3er=0; end; if c&yr.&inst.4a=0 then do; c&yr.&inst.4dr=0; c&yr.&inst.4er=0; c&yr.&inst.4fr=0; end; if c&yr.&inst.5a=0 then do; c&yr.&inst.5cr=0; c&yr.&inst.5dr=0; c&yr.&inst.5er=0; end; if c&yr.&inst.2a=1 then do; C&yr.&inst.2Br=1; end; if c&yr.&inst.3a=1 then do; C&yr.&inst.3Br=1; end; if c&yr.&inst.5a=1 then do; C&yr.&inst.5Br=1; end; if c&yr.&inst.4b=1 then C&yr.&inst.4Br=0; if c&yr.&inst.4b=0 then C&yr.&inst.4Br=1; C&yr.&inst.4Cr=c&yr.&inst.4c; if c&yr.&inst.4a=0 then do; C&yr.&inst.4Br=0; C&yr.&inst.4Cr=0; end; *create scale number of weapons child owns; &type.&yr.own=sum(of c&yr.&inst.2a c&yr.&inst.3a c&yr.&inst.5a); *create scale for number of weapons child can easily get given dont own any; if &type.&yr.own=0 then &type.&yr.get=sum(of c&yr.&inst.2b c&yr.&inst.3b c&yr.&inst.5b); if &type.&yr.own=1 then &type.&yr.get=.; *create scale for number of weapons can easily get or already own; &type.&yr.oog=sum(of c&yr.&inst.2br c&yr.&inst.3br c&yr.&inst.5br); *create scale for number of weapons carried in last 12 months; &type.&yr.car=sum(of c&yr.&inst.2cr c&yr.&inst.3cr c&yr.&inst.4dr c&yr.&inst.5cr); *create scale for number of weapons pulled on someone in last 12 months; &type.&yr.pul=sum(of c&yr.&inst.2dr c&yr.&inst.3dr c&yr.&inst.4er c&yr.&inst.5dr); *create scale for number of weapons used to hurt someone in last 12 months; &type.&yr.hur=sum(of c&yr.&inst.2er c&yr.&inst.3er c&yr.&inst.4fr c&yr.&inst.5er); *create small knife summary scale; &type.&yr.ssk=(sum(of C&yr.&inst.2A C&yr.&inst.2br C&yr.&inst.2Cr C&yr.&inst.2Dr C&yr.&inst.2Er)) ; *create large knife summary scale; &type.&yr.slk=(sum(of C&yr.&inst.3A C&yr.&inst.3br C&yr.&inst.3Cr C&yr.&inst.3Dr C&yr.&inst.3Er)) ; *create own gun summary scale; &type.&yr.sog=(sum(of C&yr.&inst.5A C&yr.&inst.5br C&yr.&inst.5Cr C&yr.&inst.5Dr C&yr.&inst.5Er)) ; *create parents gun summary scale; &type.&yr.spg=(sum(of C&yr.&inst.4A C&yr.&inst.4Br C&yr.&inst.4Cr C&yr.&inst.4Dr C&yr.&inst.4Er C&yr.&inst.4Fr)); *create all weapon summary scale; &type.&yr.saw=sum(of &type.&yr.ssk &type.&yr.slk &type.&yr.sog &type.&yr.spg); *create scale for exposure to gangs; *recode some variables; if C&yr.&inst.1f=1| C&yr.&inst.1g=1 then C&yr.&inst.1FG=1; else C&yr.&inst.1FG=0; if C&yr.&inst.1h in (2,3,4) then C&yr.&inst.1Hr=1; else C&yr.&inst.1Hr=0; if C&yr.&inst.1=1 then do; C&yr.&inst.1fg=1; C&yr.&inst.1Hr=1; end; if C&yr.&inst.1C in (3,4) then C&yr.&inst.1Cr=2; else if C&yr.&inst.1C =2 then C&yr.&inst.1Cr=1; else C&yr.&inst.1Cr=0; if C&yr.&inst.1e in (1,2) then C&yr.&inst.1Er=1; else C&yr.&inst.1Er=0; *create scale; &type.&yr.exg=C&yr.&inst.1+C&yr.&inst.1fg+C&yr.&inst.1hr+C&yr.&inst.1cr+C&yr.&inst.1er; drop i; label &type.&yr.own="# of weapons child owns" &type.&yr.get="# of weapons can easily get, if do not own one" &type.&yr.oog="# of weapons child owns or can easily get" &type.&yr.car="# of weapons carried in last 12 months" &type.&yr.pul="# of weapons pulled on someone in last 12 months" &type.&yr.hur="# of weapons used to hurt someone in last 12 months" &type.&yr.ssk="Summary of use/availability of small knife" &type.&yr.slk="Summary of use/availability of large knife" &type.&yr.sog="Summary of use/availability of own gun" &type.&yr.spg="Summary of use/availability of parents gun" &type.&yr.saw="Summary of use/availability of all weapons" &type.&yr.exg="Exposure to/Involvement in Gangs" C&yr.&inst.1="Member of Gang/Posse Last 12 Months" C&yr.&inst.1fg="Know anyone or friend who is a member of a gang" C&yr.&inst.1hr="Feel at least some pressure to join a gang" C&yr.&inst.1cr="Recoded-When did join a gang 0=this yr,1=last yr,2=2+ yrs ago" C&yr.&inst.1er="Recoded-Position in gang, 1=leader/top person, 0 else" C&yr.&inst.2Br="Recoded-(SK) Could you get one if you wanted to?" C&yr.&inst.2Cr="Recoded-(SK) Have You Carried It in Past Year?" C&yr.&inst.2Dr="Recoded-(SK) Pulled It on Someone in Past Year?" C&yr.&inst.2Er="Recoded-(SK) Hurt Someone W/ It in Past Year?" C&yr.&inst.3Br="Recoded-(LK) Could you get one if you wanted to?" C&yr.&inst.3Cr="Recoded-(LK) Have You Carried It in Past Year?" C&yr.&inst.3Dr="Recoded-(LK) Pulled It on Someone in Past Year?" C&yr.&inst.3Er="Recoded-(LK) Hurt Someone W/ It in Past Year?" C&yr.&inst.4Br="Parent's Gun Not Locked?" C&yr.&inst.4Cr="Recoded- (PH) Do Your Parents Let You Use It?" C&yr.&inst.4Dr="Recoded-(PH) Taken W/O Permission in Past Year?" C&yr.&inst.4Er="Recoded-(PH) Pulled It on Someone in Past Year?" C&yr.&inst.4Fr="Recoded-(PH) Hurt Someone W/ It in the Past Year" C&yr.&inst.5Br="Recoded-(NH) Could you get one if you wanted to?" C&yr.&inst.5Cr="Recoded-(NH) Carried It With You in The Past Year?" C&yr.&inst.5Dr="Recoded-(NH) Pulled It on Someone in the Past Year?" C&yr.&inst.5Er="Recoded-(NH) Hurt Someone With It in The Past Year?" ; run; proc sort; by cohort site tcid; run;