Transcription of APPENDIX C EXAMPLES IN SAS - Bureau of Justice …
1 1 APPENDIX C EXAMPLES IN SAS In SAS, the NCVS sample design must be appropriately specified for all survey procedures using the varmethod, strata, and cluster statements. The varmethod=taylor statement is included within the proc statement of each analysis. The following statements must be included to provide the stratification and PSU variables. strata yr_grp v2117; cluster v2118; Weight statements are also required, but vary depending on the type of estimate (as shown in Table 3-1) . Because SAS does not support the specification of formulas within the analysis procedures, for the calculation of victimization rates analysts must first create a new variable equal to the product of the victimization count and the adjustment factor (ADJINC_WT), multiplied by 1,000 (as outlined in the EXAMPLES below).
2 The domain statement is used to limit the analysis to the appropriate set of cases1. While all combinations of variables included in the domain statement will be included in the results, only the results meeting all subpopulation conditions are relevant. For this reason, prior to each analysis a sub variable is created based on all exclusions ( victimizations occurring outside of the US and outside the year(s) of interest). Including this single recoded variable on the domain statement simplifies examination of the results. EXAMPLES 1 and 2 demonstrate how to estimate the total number of victimizations. EXAMPLES 3 and 4 demonstrate how to calculate the proportion of victimizations with given characteristics. EXAMPLES 5 and 6 demonstrate the calculation of personal and property victimization rates for victimization characteristics included on the modified person and 1 In Section 3, the term analysis domain is used to define subsets of the population based on victims or victimizations.
3 In SAS, the domain statement is used to identify records to include in analyses. To avoid confusion between the two uses, the term analysis class will replace the term analysis domain in APPENDIX C. 2 household files, and example 7 demonstrates the calculation of victimization rates for victimization characteristics not on the modified files. EXAMPLES are included for both single- and pooled-year estimates. Victimization Totals The SAS surveymeans procedure is used to estimate the total number of victimizations from the modified incident-level file. The specific crime type of interest is specified in the var statement, and the analysis class(es) of interest ( subsets of the population based on characteristics of the victimization or victim) are specified on the domain statement.
4 EXAMPLES 1A-1C demonstrate the calculation of victimization totals for single years, and EXAMPLES 2A-2C demonstrate pooled year estimates. example 1: Number of victimizations, single year EXAMPLES 1A and 1B below are estimates of personal crimes, while example 1C is an estimate of property crimes. EXAMPLES 1A and 1C provide overall crime estimates, while example 1B provides estimated totals for person-level characteristics of interest. example 1A - Total number of violent victimizations, 2011 Year(s): 2011 Crime Type: violent victimizations (vcrime) Analysis Classes: n/a Weight: newwgt Subpopulation: within the United States (exclude_outUS=0); non-dummy records (dummy=0); 2011 (year=2011) Code: data anset; set adjincident; sub=(exclude_outUS=0 and dummy=0 and year=2011); run; proc surveymeans data=anset varmethod=taylor sum; *a; strata yr_grp v2117; *c; cluster v2118; *d; weight newwgt; *e; domain sub; *b; var vcrime; *f; run.
5 3 Code Comment(s): a) Specifies input dataset and sample design b) Subpopulation indicator c) Specifies stratification d) Specifies primary sampling units e) Specifies analysis weight f) Outcome of interest Output: NOTE: Output is provided overall and by subpopulation. Only the output under Domain Analysis: sub with a sub value of 1 is relevant (highlighted rows). The SURVEYMEANS Procedure Data Summary Number of Strata 160 Number of Clusters 320 Number of Observations 37853 Sum of Weights 115824878 Statistics Variable Sum Std Dev vcrime 29789137 1061238 Domain Analysis.
6 Sub sub Variable Sum Std Dev 0 vcrime 23976614 927768 1 vcrime 5812523 357912 4 example 1B - Total number of violent victimizations by sex, age category, and race/ethnicity, 2011 Year(s): 2011 Crime Type: violent victimizations (vcrime) Analysis Classes: sex (sex), age category (agecat), and race/ethnicity (race_eth) Weight: newwgt Subpopulation: within the United States (exclude_outUS=0); non-dummy records (dummy=0); 2011 (year=2011) Code: data anset; set adjincident; sub=(exclude_outUS=0 and dummy=0 and year=2011); run; proc surveymeans data=anset varmethod=taylor sum; domain sub*sex sub*agecat sub*race_eth; *a; strata yr_grp v2117; cluster v2118; weight newwgt; var vcrime; run; Code Comment(s): a) Analysis class variables (victim characteristics), crossed with subpopulation indicator Output: NOTE: Output is provided overall and by subpopulation.
7 Only the output under Domain Analysis: sub with a sub value of 1 is relevant (highlighted rows). The SURVEYMEANS Procedure Data Summary Number of Strata 160 Number of Clusters 320 Number of Observations 37853 Sum of Weights 115824878 Statistics Variable Sum Std Dev vcrime 29789137 1061238 5 Domain Analysis: sub*sex sub sex Variable Sum Std Dev 0 Male vcrime 12443058 568391 Female vcrime 11533557 551251 1 Male vcrime 3209725 236961 Female vcrime 2602798 252786 Domain Analysis.
8 Sub*agecat sub agecat Variable Sum Std Dev 0 12 to 14 vcrime 2350414 190557 15 to 17 vcrime 2351591 231698 18 to 20 vcrime 2120993 169061 21 to 24 vcrime 2671424 218252 25 to 34 vcrime 5052311 372358 35 to 49 vcrime 5846191 336304 50 to 64 vcrime 3086188 201164 65 or older vcrime 497502 61068 1 12 to 14 vcrime 488383 77368 15 to 17 vcrime 428880 64692 18 to 20 vcrime 843753 220104 21 to 24 vcrime 617720 69926 25 to 34 vcrime 1114834 118262 35 to 49 vcrime 1365450 141011 50 to 64 vcrime 776857 90922 65 or older vcrime 176646 46321 Domain Analysis.
9 Sub*race_eth sub race_eth Variable Sum Std Dev 0 Non-Hispanic White vcrime 16135969 781567 Non-Hispanic Black vcrime 3535332 327426 Hispanic vcrime 2877571 187303 Non-Hispanic Other vcrime 807284 131642 Non-Hispanic More than One Race vcrime 620459 102505 1 Non-Hispanic White vcrime 3719729 242039 Non-Hispanic Black vcrime 812173 181536 Hispanic vcrime 895434 130311 Non-Hispanic Other vcrime 197082 46736 Non-Hispanic More than One Race vcrime 188105 43090 6 example 1C - Total number of property victimizations, 2011 Year(s): 2011 Crime Type: property victimizations (pcrime) Analysis Classes: n/a Weight: newwgt Subpopulation: within the United States (exclude_outUS=0); non-dummy records (dummy=0); 2011 (year=2011) Code: data anset; set adjincident; sub=(exclude_outUS=0 and dummy=0 and year=2011); run.
10 Proc surveymeans data=anset varmethod=taylor sum; domain sub; strata yr_grp v2117; cluster v2118; weight newwgt; var pcrime; run; Output: NOTE: Output is provided overall and by subpopulation. Only the output under Domain Analysis: sub with a sub value of 1 is relevant (highlighted row). The SURVEYMEANS Procedure Data Summary Number of Strata 160 Number of Clusters 320 Number of Observations 37853 Sum of Weights 115824878 Statistics Variable Sum Std Dev pcrime 85126878 1577101 Domain Analysis: sub sub Variable Sum Std Dev 7 0 pcrime 68063730 1324122 1 pcrime 17063148 543579 8 example 2.