Good morning:
I am trying to use direct standardization to adjust a target (area of cluster concern) to that of a referent population for 2 variables (maternal age and race/ethnicity). I am trying to figure out why some strata are not displayed in graph below; also I was wondering if there was a way to color-code the graph results to target & referent populations? The missing strata are consistently for the same age groups (i.e. <20years, 25-29yrs, 35-39yrs) across all race/ethnicities. The data lines are all populating correctly. These missing age group strata appear to be those in between other strata. I have truncated the data lines to save space. THANK Y'ALL!
**** INPUT COUNTY1 (AREA OF CLUSTER CONCERN) DATA *****;
data County1_999;
County='County1';
input Mom_RaceEthnic $ Mom_Age $ Cases 11. LiveBirths 11.;
datalines;
NH_White <20yrs 168 5676
NH_White 20-24yrs 568 19692
NH_White 25-29yrs 808 33205
NH_White 30-34yrs 767 29749
NH_White 35-39yrs 354 12174
NH_White 40+yrs 110 2561
NH_Black <20yrs 164 5020
NH_Black 20-24yrs 364 12040
...;
**** INPUT COUNTY2 (REFERENT/STANDARD POPULATION) DATA *****;
data county2_999_REF;
input Mom_RaceEthnic $ Mom_Age $ Cases 11. LiveBirths 11.;
datalines;
NH_White <20yrs 75 3589
NH_White 20-24yrs 254 12351
NH_White 25-29yrs 371 21660
NH_White 30-34yrs 420 25120
NH_White 35-39yrs 280 11972
NH_White 40+yrs 75 2834
NH_Black <20yrs 148 10022
NH_Black 20-24yrs 403 24391
...;
** SORT DATA TO RUN ANALYSIS **;
proc sort data=County1_999;
by Mom_RaceEthnic Mom_Age ;
run;
proc sort data=County2_999_REF;
by Mom_RaceEthnic Mom_Age ;
run;
** RUN DIRECT STANDARDIZATION **;
ods graphics on ;
PROC STDRATE data=County1_999 REFDATA=County2_999_REF
METHOD=direct
STAT=rate(mult=10000)
EFFECT=ratio
;
population group = County event = Cases total= LiveBirths;
reference total=LiveBirths;
STRATA Mom_RaceEthnic Mom_Age/effect;
run;
ods graphics off;
NOTE: SAS (r) Proprietary Software 9.4 (TS1M3)
Licensed to TX DEPARTMENT OF STATE HEALTH SERVICES, Site 70206481.
NOTE: This session is executing on the X64_8PRO platform.
NOTE: Updated analytical products:
SAS/STAT 14.1
SAS/ETS 14.1
SAS/OR 14.1
SAS/IML 14.1
SAS/QC 14.1
NOTE: Additional host information:
X64_8PRO WIN 6.2.9200 Workstation
NOTE: SAS initialization used:
real time 1.56 seconds
cpu time 1.14 seconds
1 ** NAME: DirectStandardCombo.SAS;
2 ** PURPOSE: DIRECT STANDARDIZATION FOR COUNTY CLUSTER**;
3
4
5 title1 "County Cluster Concern ";
6 title2 "Direct Standardization (County2= Referent Population) for Defect:
6 ! Adjusted by Maternal Age & Race/Ethnicity";
7
8 ************************************;
9 ** CREATE DATA FOR STANDARDIZATION **;
10 ************************************;
11
12 **** INPUT COUNTY1 (AREA OF CLUSTER CONCERN) DATA *****;
13 data County1;
14 County='County1';
15 input Mom_RaceEthnic $ Mom_Age $ Cases 11. LiveBirths 11.;
16 datalines;
NOTE: The data set WORK.COUNTY1 has 24 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
41 ;
42
43 title3 'Area of Geographic Clustering Concern: County1';
44 proc print data=County1;
NOTE: Writing HTML Body file: sashtml.htm
45 run;
NOTE: There were 24 observations read from the data set WORK.COUNTY1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.89 seconds
cpu time 0.37 seconds
46
47
48 **** INPUT COUNTY2 (REFERENT/STANDARD POPULATION) DATA *****;
49 data County2_REF;
50 County='County2';
51 input Mom_RaceEthnic $ Mom_Age $ Cases 11. LiveBirths 11.;
52 datalines;
NOTE: The data set WORK.COUNTY2_REF has 24 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
77 ;
78
79 title3 'Standardized/Referent Population: County2';
80 proc print data=County2_REF;
81 run;
NOTE: There were 24 observations read from the data set WORK.COUNTY2_REF.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.06 seconds
cpu time 0.03 seconds
82 title3;
83
84 ************************************;
85 ** SORT DATA TO RUN ANALYSIS **;
86 ************************************;
87
88 proc sort data=County1;
89 by Mom_RaceEthnic Mom_Age ;
90 run;
NOTE: There were 24 observations read from the data set WORK.COUNTY1.
NOTE: The data set WORK.COUNTY1 has 24 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
91
92 proc sort data=County2_REF;
93 by Mom_RaceEthnic Mom_Age ;
94 run;
NOTE: There were 24 observations read from the data set WORK.COUNTY2_REF.
NOTE: The data set WORK.COUNTY2_REF has 24 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
95
96 ************************************;
97 ** RUN DIRECT STANDARDIZATION **;
98 ************************************;
99
100 ods graphics on ;
101 PROC STDRATE data=County1 REFDATA=County2_REF
102 METHOD=direct
103 STAT=rate(mult=10000)
104 EFFECT=ratio
105 ;
106 population group = County event = Cases total= LiveBirths;
107 reference total=LiveBirths;
108 STRATA Mom_RaceEthnic Mom_Age/effect;
109 run;
NOTE: With only one group in the DATA= data set, the GROUP= option in the
POPULATION statement is not used.
NOTE: PROCEDURE STDRATE used (Total process time):
real time 1.26 seconds
cpu time 0.31 seconds
110 ods graphics off;
111
112
113 **************************************************;
114 **************************************************;
115 ** END DIRECT STANDARDIZATION **;
116 **************************************************;
117 **************************************************;
Hi Reeza:
Thank you for your response.
Essentially I am trying to run a multivariable direct standardization. The strata are maternal race/ethnicity * maternal age group:
ex. White <20year
Black <20year
Hispanic <20year
White 20to24year
Black 20to24year
Hispanic 20to24year
White 25to29year
Black 25to29year
Hispanic 25to29year
etc
Thank you for your time and insights!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.