Changeset 24491 in main
- Timestamp:
- 01/18/22 15:34:00 (4 months ago)
- Location:
- adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT
- Files:
-
- 2 added
- 5 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/ed/NM_RateAA100K.def
r24369 r24491 51 51 retain count 0; 52 52 do 53 &STDVAR. = 1 to &NCAT. by 1 ;53 &STDVAR. = 1 to &NCAT. by 1 ; 54 54 output; 55 55 end; … … 132 132 select tmp.*, pop.* 133 133 from tmp left join pop 134 on tmp.&STDVAR =pop.&STDVAR.134 on tmp.&STDVAR = pop.&STDVAR. 135 135 ?popcross1? and tmp.%cross1%=pop.%popcross1% 136 136 ?popcross2? and tmp.%cross2%=pop.%popcross2% … … 296 296 f out_variable 297 297 # definition for output file 298 f xml_out_map_file XMLRate10 KNDLCLUCL.map298 f xml_out_map_file XMLRate100KNDLCLUCL.map 299 299 --------BoNdArY-------- 300 300 f out_detail lbl_not_used__see_xml_out_map_file -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/hidd/NM_CrudeRate100K.def
r24441 r24491 204 204 rateper 205 205 n 206 popcount 207 LL 208 UL 209 --------BoNdArY-------- 206 --------BoNdArY-------- -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/hidd/NM_CrudeRate10k.def
r24441 r24491 205 205 rateper 206 206 n 207 popcount 208 LL 209 UL 210 --------BoNdArY-------- 207 --------BoNdArY-------- -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/hidd/NM_RateAA10K_GE35.def
r24441 r24491 192 192 ****************************************************************; 193 193 proc sql; 194 create table numbers2 as195 select numbers.*, stdwgt.stdwgt196 from numbers left join stdwgt197 on numbers.&STDVAR.=stdwgt.&STDVAR.198 ;199 quit;194 create table numbers2 as 195 select numbers.*, stdwgt.stdwgt 196 from numbers left join stdwgt 197 on numbers.&STDVAR.=stdwgt.&STDVAR. 198 ; 199 quit; 200 200 201 201 proc print data=numbers2 noobs; -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/mortmc
-
Property
svn:global-ignores
set to
NOT USED
notused
-
Property
svn:global-ignores
set to
-
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/mortmc/NM_CrudeRate10k.def
r21905 r24491 1 f label Crude&Rate 1 #NM_RateCrude10K.def 2 2 f type special 3 #f data_where4 #f pop_where 1<=region<=55 3 ######################################### 6 4 --------BoNdArY-------- 7 5 1 script 8 OPTIONS MPRINT MLOGIC SYMBOLGEN ;6 OPTIONS MPRINT MLOGIC SYMBOLGEN NONUMBER NODATE PAGESIZE=4000; 9 7 OPTION SPOOL; 8 9 %LET MULTIPLIER=10000; 10 11 **************** 1. Numerator data, TMP *******; 10 12 11 13 proc summary data=tmp; 12 14 var x; 13 class %cross1% %cross2%; 14 output out=tmp sum=number; 15 proc print data=tmp; title1 ' '; title2 'TMP'; 16 run; 17 18 19 %let popflag=0; 15 class %cross1% 16 ?cross2? %cross2% 17 ; 18 output out=tmp (drop=_TYPE_ _FREQ_) 19 sum=number; 20 21 proc sort data=tmp out=sorted; by %cross1% 22 ?cross2? %cross2% 23 ; 24 run; 25 26 proc print data=tmp noobs; 27 title1 '----------------------------------'; 28 title2 '1. Numerator data -- TMP '; 29 title3 '----------------------------------'; 30 run; 31 32 **************** 2. %data_frame% ***************; 33 34 35 data frame; 36 set df_%cross1%%cross2% ; 37 run; 38 proc sort data=frame; by %cross1% 39 ?cross2? %cross2% 40 ; run; 41 proc print data=frame noobs; 42 title2 '2. Data Frame'; 43 run; 44 45 data tmp; 46 merge frame sorted; *must list frame dataset first, then tmp; 47 by %cross1% 48 ?cross2? %cross2% 49 ; 50 run; 51 proc print data=tmp noobs; 52 title2 '2. Framed Numerator data -- TMP '; 53 run; 54 55 56 ****** Join pop denominators framed data. ******; 57 20 58 %let flag=0; 21 %let pflag=0;22 59 ?popcross1? %let flag=1; 23 ?popcross1? %let pflag=1;24 60 ?popcross2? %let flag=1; 25 ?popcross2? %let pflag=2;26 27 61 ?popcross1? ?popcross2? %let flag=2; 28 62 … … 30 64 31 65 %if &flag=0 %then %do; 32 proc summary data=poptmp; 33 var popcount; 34 output out=pop sum=popnum; 35 run; 36 37 proc print data=pop; title2 'POP'; 38 run; 39 proc sql; 40 create table rate as 41 select tmp.*, pop.* 42 from tmp, pop 43 quit; 66 proc summary data=poptmp; 67 var popcount; 68 output out=pop (drop=_TYPE_ _FREQ_) 69 sum=popnum; 70 run; 71 72 proc print data=pop; 73 title2 '3. Population Denominators '; 74 run; 75 76 proc sql; 77 create table rate as 78 select tmp.*, pop.* 79 from tmp, pop 80 quit; 44 81 %end; 45 82 46 83 %if &flag=1 %then %do; 47 proc summary data=poptmp; 48 var popcount; 49 class %popcross1% %popcross2%; 50 output out=pop sum=popnum; 51 proc print data=pop; title2 'POP'; 84 proc summary data=poptmp; 85 var popcount; 86 class %popcross1% %popcross2%; 87 output out=pop (drop=_TYPE_ _FREQ_) 88 sum=popnum; 89 proc print data=pop; 90 title2 '3. Population Denominators '; 91 run; 92 93 proc sql; 94 create table rate as 95 select tmp.*, pop.* 96 from tmp left join pop 97 on 98 ?popcross1? tmp.%cross1%=pop.%popcross1%; 99 ?popcross2? tmp.%cross2%=pop.%popcross2%; 100 quit; 101 %end; 102 103 %if &flag=2 %then %do; 104 proc summary data=poptmp; 105 var popcount; 106 class %popcross1% %popcross2% ; 107 output out=pop (drop=_TYPE_ _FREQ_) 108 sum=popnum; 109 proc print data=pop; 110 title2 '3. Numerator & Denominators '; 52 111 run; 53 112 proc sql; 54 113 create table rate as 55 select tmp.*, pop.*, 56 coalesce 57 ?popcross1? (tmp.%cross1%, pop.%popcross1%) 58 ?popcross2? (tmp.%cross2%, pop.%popcross2%) 59 from pop full join tmp 114 select tmp.*, pop.* 115 from tmp full join pop 60 116 on 61 62 63 ?popcross1? tmp.%cross1%=pop.%popcross1%;64 ?popcross2? tmp.%cross2%=pop.%popcross2%;65 quit;66 data rate;67 set rate;68 %let popflag=1;69 run;70 %end;71 72 %if &flag=2 %then %do;73 proc summary data=poptmp;74 var popcount;75 class %popcross1% %popcross2% ;76 output out=pop sum=popnum;77 proc print data=pop; title2 'POP';78 run;79 proc sql;80 create table rate as81 select tmp.*, pop.*,82 coalesce (tmp.%cross1%, pop.%popcross1%),83 coalesce (tmp.%cross2%, pop.%popcross2%)84 from pop full join tmp85 on86 87 117 tmp.%cross1%=pop.%popcross1% and 88 118 tmp.%cross2%=pop.%popcross2%; 89 quit; 90 data rate; 91 set rate; 92 %let popflag=2; 93 run; 94 95 %end; 119 quit; 120 %end; 96 121 %mend; 97 122 %popcross; 98 123 99 proc print data=rate; title2 'RATE'; 100 101 %macro criscros; 102 %if &popflag = 1 and &pflag = 1 %then %do; 103 %cross1% = _TEMA001; 104 %end; 105 %else 106 %if &popflag = 1 and &pflag = 2 %then %do; 107 %cross2% = _TEMA001; 108 %end; 109 %mend criscros; 110 111 %macro crostwo; 112 %if &popflag = 2 %then %do; 113 %cross1% = _TEMA001; 114 %cross2% = _TEMA002; 115 %end; 116 %mend crostwo; 117 118 data tmp; 124 proc print data=rate; 125 title2 '3. Rate Ready Data '; 126 run; 127 128 129 ****************** Rates data. ***************; 130 131 data rates; 119 132 set rate; 120 %criscros; 121 %crostwo; 122 123 if number=. then n=0; else n=number; 124 rate=n/popnum; 125 rateper=(rate*10000); 126 stderr=sqrt(rate*(1-rate)/popnum)*10000; 127 t1=(rateper-(1.96*stderr)); 128 if (t1<0) then t1=0; 129 LCL=put(t1, 8.2); 130 UCL=put((rateper+(1.96*stderr)), 8.2); 131 LCL=compress(LCL); 132 UCL=compress(UCL); 133 CI=LCL || ' - ' || UCL; 134 135 136 *redflag; 137 /*redflag is the statistical stability indicator, 138 based on the relative standard error (RSE, or 139 coefficient of variance). Redflag values are 140 converted to images or special characters in XSLT 141 files (xslt\html\query\module\result\ResultPage.xslt 142 and ...Values.xslt*/ 143 144 rse=(stderr/rateper); 145 if rse>.3 then redflag=1; *statistical stability 1 red flag; 146 if rse>.5 then redflag=2; *statistical stability - 2 red flags; 147 if stderr=. then redflag=2; *no variance, n=1; 133 if number=. then n=0; else n=number; 134 rate=n/popnum; 135 if n > 0 then do; 136 rateper=(rate*&MULTIPLIER); 137 stderr=sqrt(rate*(1-rate)/popnum)*&MULTIPLIER; 138 end; 139 if n <= 0 then do; 140 rateper=0; 141 stderr=sqrt((3/popcount)*(1-(3/popnum))/popnum)*&MULTIPLIER; 142 end; 143 t1=(rateper-(1.96*stderr)); 144 if (t1<0) then t1=0; 145 LCL=put(t1, 8.2); 146 UCL=put((rateper+(1.96*stderr)), 8.2); 147 LCL=compress(LCL); 148 UCL=compress(UCL); 149 150 151 ******** Statistical Stability Redflag. ********; 152 /*Redflag is the statistical stability indicator, 153 based on RSE converted to images or special 154 characters in XSLT files ResultPage.xslt and 155 Values.xslt (xslt\html\query\module\result\).*/ 156 157 if n > 0 then do; 158 rse=(stderr/rateper); 159 redflag=put('', $12.); 160 if rse>.3 then redflag=put('Unstable', $12.); 161 if rse>.5 then redflag=put('VeryUnstable', $12.); 162 if stderr=. then redflag=put('Unstable', $12.); 163 end; 164 if n <= 0 then redflag=put('Unstable', $12.); 165 *no variance, n=0, rse=div by zero; 148 166 run; 149 proc print data=tmp; title 'almost final tmp'; run; 150 151 data tmp; 152 set tmp; 153 /* New Mexico Small Numbers Rule */ 154 if ((0<n<4) and (popnum<5000)) then do; 155 n = .A; 156 rateper = .A; 157 LCL = put('**', 8.0); 158 UCL = put('**', 8.0); 159 end; 160 proc print data=tmp; title 'final tmp'; run; 167 168 proc print data=rates; 169 title2 '4. Rates Data '; 170 run; 171 172 173 ********* New Mexico Small Numbers Rule ******; 174 175 data tmp; 176 set rates; 177 if ((0<n<4) and (popnum<5000)) then do; 178 n = .A; 179 LCL = put('**', 8.0); 180 UCL = put('**', 8.0); 181 redflag = put('Suppressed', $12.); 182 end; 183 if popnum=. then redflag=put('', $12.); 184 run; 185 186 proc print data=tmp; 187 title2 '5. Final Data '; run; 161 188 162 189 --------BoNdArY-------- 163 190 f out_variable rateper 164 191 # definition for output file 165 f xml_out_map_file XMLRate10 KNDLCLUCL.map192 f xml_out_map_file XMLRate100KNDLCLUCL.map 166 193 --------BoNdArY-------- 167 194 f out_detail lbl_not_used__see_xml_out_map_file … … 169 196 n 15.0 170 197 popnum 15.0 171 LCL 15.1 172 UCL 15.1 173 redflag 15.0 174 --------BoNdArY-------- 175 --------BoNdArY-------- 176 1 suppressed_variables 4 198 LCL 15.3 199 UCL 15.3 200 redflag 12.0 201 --------BoNdArY-------- 202 --------BoNdArY-------- 203 1 suppressed_variables 5 204 rateper 177 205 n 178 rateper179 L CL180 U CL181 --------BoNdArY-------- 206 popcount 207 LL 208 UL 209 --------BoNdArY-------- -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/mortmc/NM_RateAA100K_GE35.def
r21905 r24491 1 #NM_RateAA10 0K_GE35.def1 #NM_RateAA10K_GE35.def 2 2 #Calculates directly age-adjusted rates per 10,000 for 3 3 # records that have been filtered by IBIS-Q (data=tmp) … … 15 15 OPTION SPOOL; 16 16 17 %LET MULTIPLIER=100000; 18 %LET STDVAR=agepop; 19 %LET NCAT=11; 17 20 ************************** 1. TMP ******************************; 18 21 * The dataset 'tmp' is the numerator dataset that has been read ; … … 23 26 proc summary data=tmp; 24 27 var x; 25 class agegrp18%cross1%28 class &STDVAR. %cross1% 26 29 ?cross2? %cross2% 27 30 ; 28 31 output out=tmp sum=count; 29 proc sort data=tmp; by agegrp18 %cross1%30 ?cross2? %cross2%31 ;run;32 proc sort data=tmp; 33 by %cross1% %cross2% &STDVAR. ; 34 run; 32 35 proc print data=tmp noobs; 33 36 title1 '---------------------------------'; … … 45 48 retain count 0; 46 49 do 47 agegrp18 = 1 to 18by 1 ;50 &STDVAR. = 1 to &NCAT. by 1 ; 48 51 output; 49 52 end; … … 78 81 by %cross1% 79 82 ?cross2? %cross2% 80 81 agegrp18; 83 &STDVAR. ; 82 84 run; 83 85 proc print data=new_frame noobs; title2 'new_frame, sorted with nodupkey'; run; 84 proc sort data=tmp; by %cross1% %cross2% agegrp18; run; 86 proc sort data=tmp; by %cross1% %cross2% &STDVAR. ; 87 run; 88 89 proc sort data=tmp out=sorted; 90 by %cross1% %cross2% &STDVAR; run; 85 91 data newtmp; 86 merge new_frame tmp; *must list frame dataset first, thentmp;87 by %cross1% %cross2% agegrp18;92 merge new_frame sorted; * tmp, must list frame dataset first, then sorted tmp; 93 by %cross1% %cross2% &STDVAR.; 88 94 drop _TYPE_ _FREQ_ ; 89 95 run; … … 101 107 * cross1 and cross2 totals to -1. ; 102 108 ****************************************************************; 103 data poptmp; format agegrp18%popcross1% %popcross2% 8.; set poptmp; run;109 data poptmp; format &STDVAR %popcross1% %popcross2% 8.; set poptmp; run; 104 110 proc summary data=poptmp; 105 111 var popcount; 106 class agegrp18 %popcross1% %popcross2%; 107 output out=pop sum=popcount; 112 class &STDVAR %popcross1% %popcross2%; 113 output out=pop (drop=_TYPE_ _FREQ_) 114 sum=popcount; 108 115 run; 109 116 data pop; 110 117 set pop; 111 drop _TYPE_ _FREQ_;112 118 proc print data=pop noobs; 113 119 title2 '3. POP - denominator dataset'; … … 123 129 select tmp.*, pop.* 124 130 from tmp left join pop 125 on tmp. agegrp18=pop.agegrp18131 on tmp.&STDVAR.=pop.&STDVAR. 126 132 ?popcross1? and tmp.%cross1%=pop.%popcross1% 127 133 ?popcross2? and tmp.%cross2%=pop.%popcross2% … … 130 136 data numbers; 131 137 set numbers; 132 if agegrp18^=.; *get rid of total rows to stop doubling from pop proc summary;138 if &STDVAR. ^=.; *get rid of total rows to stop doubling from pop proc summary; 133 139 if %cross1%=. then %cross1%=-1; 134 140 ?cross2? if %cross2%=. then %cross2%=-1; … … 157 163 set pop.stdwgts; 158 164 *pop libname is set in .cfg file with the saspop statement; 159 if (stdvar=' AgeGrp18GE25'); *stdvar name is case-sensitive;160 keep agegrp18stdwgt;165 if (stdvar='agepopGE35'); *stdvar name is case-sensitive; 166 keep &STDVAR. stdwgt; 161 167 run; 162 168 proc print data=stdwgt noobs; … … 172 178 select numbers.*, stdwgt.stdwgt 173 179 from numbers left join stdwgt 174 on numbers. agegrp18=stdwgt.agegrp18175 ;180 on numbers.&STDVAR.=stdwgt.&STDVAR. 181 ; 176 182 quit; 177 183 proc print data=numbers2 noobs; … … 200 206 var ratewgt rate_var count popcount; 201 207 class %cross1% %cross2%; 202 output out=aarate sum(ratewgt rate_var count popcount)=aarate aarate_var count popcount; 208 output out=aarate (drop=_TYPE_ _FREQ_ ) 209 sum(ratewgt rate_var count popcount)=aarate aarate_var count popcount; 203 210 run; 204 211 data aarate; … … 208 215 proc sort data=aarate; by %cross1% %cross2%; run; 209 216 proc print data=aarate noobs; 210 title2 '8. AARATE - summed across weighted agepopcross-products to get AA rate and';217 title2 '8. AARATE - summed across weighted &STDVAR. cross-products to get AA rate and'; 211 218 title3 'rate variance within each cross-by var'; 212 219 run; … … 217 224 * coded back to '.' after this step. ; 218 225 ****************************************************************; 219 data tmp;226 data rate; 220 227 set aarate; 221 228 if %cross1%=-1 then %cross1%=.; *Recode the statewide totals.; … … 223 230 224 231 if (count>0) then do; 225 rateper=(aarate* 100000);232 rateper=(aarate*&MULTIPLIER.); 226 233 rate_se=sqrt(aarate_var); 227 stderr=(rate_se* 100000);234 stderr=(rate_se*&MULTIPLIER.); 228 235 end; 229 236 if (count<=0) then do; … … 231 238 232 239 rateper=0; 233 stderr=sqrt((3/popcount)*(1-(3/popcount))/popcount)* 100000;240 stderr=sqrt((3/popcount)*(1-(3/popcount))/popcount)*&MULTIPLIER.; 234 241 end; 235 242 t1=(rateper-(1.96*stderr)); … … 250 257 if count>0 then do; 251 258 rse=(stderr/rateper); 252 redflag=put(' -', $14.);253 if rse>.3 then redflag=put('Unstable', $1 4.);254 if rse>.5 then redflag=put('Very Unstable', $1 4.);255 if stderr=. then redflag=put('Unstable', $1 4.);259 redflag=put(' ', $12.); 260 if rse>.3 then redflag=put('Unstable', $12.); 261 if rse>.5 then redflag=put('Very Unstable', $12.); 262 if stderr=. then redflag=put('Unstable', $12.); 256 263 end; 257 if count<=0 then redflag=put('Unstable', $1 4.); *no variance, n=0, rse=div by zero;264 if count<=0 then redflag=put('Unstable', $12.); *no variance, n=0, rse=div by zero; 258 265 run; 259 266 … … 271 278 *******************************************************************; 272 279 data tmp; 273 set tmp;280 set rate; 274 281 if ((0<n<4) and (popcount<5000)) then do; 275 282 n = .A; … … 277 284 LL = put('**', 8.0); 278 285 UL = put('**', 8.0); 286 redflag = put('Suppressed', $12.); 279 287 end; 280 288 proc print data=tmp noobs; title2 '11. TMP - final dataset to pass to IBIS View app'; … … 284 292 f out_variable 285 293 # definition for output file 286 f xml_out_map_file XMLRate10 0KNDLCLUCL.map294 f xml_out_map_file XMLRate10KNDLCLUCL.map 287 295 --------BoNdArY-------- 288 296 f out_detail lbl_not_used__see_xml_out_map_file -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/mortmc/NM_RateAA10K.def
r21905 r24491 15 15 OPTION SPOOL; 16 16 17 %LET MULTIPLIER=10000; 18 %LET STDVAR=agepop; 19 %LET NCAT=11; 17 20 ************************** 1. TMP ******************************; 18 21 * The dataset 'tmp' is the numerator dataset that has been read ; 19 22 * in already by ibis-q. Any filters have already been applied. ; 20 * The proc summary counts deaths by agepop , cross1, and cross2. ;23 * The proc summary counts deaths by agepop_a, cross1, and cross2. ; 21 24 * The variable "x" must be in the dataset, it is set equal to 1.; 22 25 ****************************************************************; 26 23 27 proc summary data=tmp; 24 28 var x; 25 class agepop%cross1%29 class &STDVAR. %cross1% 26 30 ?cross2? %cross2% 27 31 ; 28 output out=tmp sum=count; 29 proc sort data=tmp; by agepop %cross1% 30 ?cross2? %cross2% 32 output out=tmp (drop=_TYPE_ _FREQ_) sum=count; 33 34 proc sort data=tmp; 35 by %cross1% %cross2% &STDVAR.; 31 36 ; run; 32 37 proc print data=tmp noobs; 33 title1 '---------------------------------'; 34 title2 '1. TMP - numerator dataset'; 35 run; 38 title1 '---------------------------------'; 39 title2 '1. TMP - numerator dataset '; 40 title3 '---------------------------------'; 41 run; 36 42 37 43 ********************** 2. %data_frame% *************************; … … 43 49 ****************************************************************; 44 50 data agepop_frame; 45 retain count 0;46 do47 agepop= 1 to 11by 1 ;51 retain count 0; 52 do 53 &STDVAR. = 1 to &NCAT. by 1 ; 48 54 output; 49 end;55 end; 50 56 run; 51 57 *************************************************************************************; … … 55 61 * then crosses by sex), there will be a total row for the cross1 and cross2 values. ; 56 62 * So in a later step, the new_frame dataset is sorted with a "nodupkey" option to ; 57 * remove the additional dimension total values. 63 * remove the additional dimension total values.; 58 64 *************************************************************************************; 65 59 66 data crosstotalframe; 60 retain count 0;61 do67 retain count 0; 68 do 62 69 %cross1%=.; 63 70 ?cross2? %cross2%=.; 64 71 output; 65 end; 66 run; 72 end; 73 run; 74 67 75 data df_%cross1%%cross2%; 68 set df_%cross1%%cross2% crosstotalframe; 69 run; 70 proc print data=df_%cross1%%cross2% noobs; title2 'cross1cross2 frame with total row'; run; 71 proc print data=agepop_frame noobs; title2 'agepop frame'; run; 76 set df_%cross1%%cross2% crosstotalframe; 77 run; 78 79 proc print data=df_%cross1%%cross2% noobs; 80 title2 'cross1cross2 frame with total row'; run; 81 proc print data=agepop_frame noobs; 82 title2 'agepop frame'; run; 72 83 proc sql; 73 84 create table new_frame as … … 76 87 quit; 77 88 proc sort data=new_frame nodupkey; 78 by %cross1% 79 ?cross2? %cross2% 80 agepop; 81 run; 82 proc print data=new_frame noobs; title2 'new_frame, sorted with nodupkey'; run; 83 proc sort data=tmp; by %cross1% %cross2% agepop; run; 84 data newtmp; 85 merge new_frame tmp; *must list frame dataset first, then tmp; 86 by %cross1% %cross2% agepop; 87 drop _TYPE_ _FREQ_ ; 89 by %cross1% 90 ?cross2? %cross2% 91 &STDVAR.; 92 run; 93 94 proc print data=new_frame noobs; 95 title2 'new_frame, sorted with nodupkey'; run; 96 97 proc sort data=tmp out=sorted; 98 by %cross1% %cross2% &STDVAR; run; 99 data newtmp; 100 merge new_frame sorted; * tmp, must list frame dataset first, then sorted tmp; 101 by %cross1% %cross2% &STDVAR.; 102 drop _TYPE_ _FREQ_ ; 88 103 run; 89 104 90 105 proc print data=newtmp noobs; 91 title2 '2. NEWTMP, after frame merged with tmp';106 title2 '2. NEWTMP, after frame merged with tmp'; 92 107 run; 93 108 data tmp; 94 109 set newtmp; 95 110 run; 96 111 … … 100 115 * cross1 and cross2 totals to -1. ; 101 116 ****************************************************************; 102 data poptmp; format agepop %popcross1% %popcross2% 8.; set poptmp; run; 117 data poptmp; 118 format &STDVAR. %popcross1% %popcross2% 8.; 119 set poptmp; 120 run; 103 121 proc summary data=poptmp; 104 122 var popcount; 105 class agepop%popcross1% %popcross2%;106 output out=pop sum=popcount;123 class &STDVAR. %popcross1% %popcross2%; 124 output out=pop (drop=_TYPE_ _FREQ_) sum=popcount; 107 125 run; 108 126 data pop; 109 set pop; 110 drop _TYPE_ _FREQ_; 111 proc print data=pop noobs; 112 title2 '3. POP - denominator dataset'; 113 run; 114 127 set pop; 128 129 proc print data=pop noobs; 130 title1 '---------------------------------'; 131 title2 '3. POP - denominator dataset '; 132 title3 '---------------------------------'; 133 run; 134 115 135 *********************** 4. NUMBERS *****************************; 116 136 * Join tmp, pop. ; 117 137 * -1 values are left of out NUMBERS because stdpop doesn't have ; 118 * any -1 values. ; 138 * any -1 values. ; 139 * The popcross flag is not used here because the use of the age grouping variable ; 140 * allows for each of the following rows of the join statement to begin with "and". ; 119 141 ****************************************************************; 120 142 proc sql; … … 122 144 select tmp.*, pop.* 123 145 from tmp left join pop 124 on tmp. agepop=pop.agepop146 on tmp.&STDVAR. = pop.&STDVAR. 125 147 ?popcross1? and tmp.%cross1%=pop.%popcross1% 126 148 ?popcross2? and tmp.%cross2%=pop.%popcross2% … … 129 151 data numbers; 130 152 set numbers; 131 if agepop^=.; *get rid of total rows to stop doubling from pop proc summary;153 if &STDVAR.^=.; *get rid of total rows to stop doubling from pop proc summary; 132 154 if %cross1%=. then %cross1%=-1; 133 155 ?cross2? if %cross2%=. then %cross2%=-1; 134 156 proc print data=numbers noobs; 135 title2 '4. NUMBERS';136 title3 '';157 title2 '4. NUMBERS '; 158 title3 '---------------------------------'; 137 159 run; 138 160 139 161 ************************ 5. STDWGT *****************************; 140 * Select the appropriate records from the stdwgts datafile.;141 * All weights are for U.S. 2000 standard population (per NCHS ; 142 * Statnote20). 'stdvar' values are as follows:;143 * agepop - the standard 11 age group weights;144 * agepopGE35 - agepop wgts for age>=35;145 * AADist10 - Statnote20 dist #10, for BRFSS;146 * AADist10GE40 - AADist10 for ages >=40;147 * AADist10GE50 - AADist10 for ages >=50;148 * AgeGrp18 - 5-year age groups, for cancer data;149 * AgeGrp18LT50 - AgeGrp18 for age <50 ; 150 * AgeGrp18GE50 - AgeGrp18 for age >=50 ; 151 * AgeGrp18LT15 - AgeGrp18 for age <15 ; 152 * AgeGrp18LT20 - AgeGrp18 for age <20 ; 162 * Select the appropriate records from the stdwgts datafile. ; 163 164 *'stdvar' variable names are as follows: ; 165 * agepop - the standard 11 age group weights ; 166 * agepopGE25 - agepop wgts for age>=35 ; 167 * agepopGE35 - agepop wgts for age>=35 ; 168 * Using this version of the age-adjustment .DEF file requires ; 169 * that you have variables in both your numerator and denominator; 170 * datasets with this variable name. ; 171 172 173 174 153 175 ****************************************************************; 154 176 data stdwgt; 155 informat stdwgt 7.6; 156 set pop.stdwgts; 157 *pop libname is set in .cfg file with the saspop statement; 158 if (stdvar='agepop'); *stdvar name is case-sensitive; 159 keep agepop stdwgt; 160 run; 177 *format agevar $12.; 178 informat stdwgt 7.6; 179 set pop.stdwgts; 180 *pop libname is set in .cfg file with the saspop statement; 181 if (stdvar="&STDVAR."); 182 keep &STDVAR. stdwgt; 183 run; 161 184 proc print data=stdwgt noobs; 162 185 title2 '5. STDWGT- std. pop. weights for direct age-adjustment'; … … 171 194 select numbers.*, stdwgt.stdwgt 172 195 from numbers left join stdwgt 173 on numbers. agepop=stdwgt.agepop196 on numbers.&STDVAR.=stdwgt.&STDVAR. 174 197 ; 175 198 quit; … … 197 220 *****************************************************************; 198 221 proc summary data=agespecific nway; 199 var ratewgt rate_var count popcount; 200 class %cross1% %cross2%; 201 output out=aarate sum(ratewgt rate_var count popcount)=aarate aarate_var count popcount; 202 run; 203 data aarate; 204 set aarate; 205 drop _TYPE_ _FREQ_ ; 206 run; 207 proc sort data=aarate; by %cross1% %cross2%; run; 222 var ratewgt rate_var count popcount; 223 class %cross1% %cross2%; 224 output out=aarate (drop=_TYPE_ _FREQ_ ) 225 sum(ratewgt rate_var count popcount)=aarate aarate_var count popcount; 226 run; 227 228 229 230 231 proc sort data=aarate; by %cross1% %cross2%; run; 208 232 proc print data=aarate noobs; 209 title2 '8. AARATE - summed across weighted agepop cross-products to get AA rate and';233 title2 "8. AARATE - summed across weighted &STDVAR. cross-products to get AA rate and"; 210 234 title3 'rate variance within each cross-by var'; 211 235 run; … … 216 240 * coded back to '.' after this step. ; 217 241 ****************************************************************; 218 data tmp; 242 243 data rate; 219 244 set aarate; 220 245 if %cross1%=-1 then %cross1%=.; *Recode the statewide totals.; … … 222 247 223 248 if (count>0) then do; 224 rateper=(aarate* 10000);249 rateper=(aarate*&MULTIPLIER.); 225 250 rate_se=sqrt(aarate_var); 226 stderr=(rate_se* 10000);251 stderr=(rate_se*&MULTIPLIER.); 227 252 end; 228 253 if (count<=0) then do; … … 230 255 231 256 rateper=0; 232 stderr=sqrt((3/popcount)*(1-(3/popcount))/popcount)* 10000;257 stderr=sqrt((3/popcount)*(1-(3/popcount))/popcount)*&MULTIPLIER.; 233 258 end; 234 259 t1=(rateper-(1.96*stderr)); … … 247 272 * (xslt\html\query\module\result\ResultPage.xslt, ...Values.xslt ; 248 273 *****************************************************************; 274 249 275 if count>0 then do; 250 276 rse=(stderr/rateper); 251 redflag=put(' -', $14.);252 if rse>.3 then redflag=put('Unstable', $1 4.);253 if rse>.5 then redflag=put('Very Unstable', $1 4.);254 if stderr=. then redflag=put('Unstable', $1 4.);277 redflag=put(' ', $12.); 278 if rse>.3 then redflag=put('Unstable', $12.); 279 if rse>.5 then redflag=put('Very Unstable', $12.); 280 if stderr=. then redflag=put('Unstable', $12.); 255 281 end; 256 if count<=0 then redflag=put('Unstable', $1 4.); *no variance, n=0, rse=div by zero;282 if count<=0 then redflag=put('Unstable', $12.); *no variance, n=0, rse=div by zero; 257 283 run; 258 284 … … 269 295 * code at the end of this file to work. ; 270 296 *******************************************************************; 297 271 298 data tmp; 272 set tmp;273 if ((0<n<4) and ( popcount<5000)) then do;299 set rate; 300 if ((0<n<4) and (.<popcount<5000)) then do; 274 301 n = .A; 275 302 rateper = .A; 276 303 LL = put('**', 8.0); 277 304 UL = put('**', 8.0); 305 *only 1 val attr allowed, over-write redflag if suppressed; 306 redflag = put('Suppressed', $12.); 278 307 end; 279 308 proc print data=tmp noobs; title2 '11. TMP - final dataset to pass to IBIS View app'; … … 283 312 f out_variable 284 313 # definition for output file 285 f xml_out_map_file XMLRate10 KNDLCLUCL.map314 f xml_out_map_file XMLRate100KNDLCLUCL.map 286 315 --------BoNdArY-------- 287 316 f out_detail lbl_not_used__see_xml_out_map_file -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/mortmc/NM_RateAA10K_GE35.def
r21905 r24491 1 #NM_RateAA10 0K_GE35.def1 #NM_RateAA10K_GE35.def 2 2 #Calculates directly age-adjusted rates per 10,000 for 3 3 # records that have been filtered by IBIS-Q (data=tmp) … … 15 15 OPTION SPOOL; 16 16 17 %LET MULTIPLIER=10000; 18 %LET STDVAR=agepop; 19 %LET NCAT=11; 17 20 ************************** 1. TMP ******************************; 18 21 * The dataset 'tmp' is the numerator dataset that has been read ; … … 23 26 proc summary data=tmp; 24 27 var x; 25 class agegrp18%cross1%28 class &STDVAR. %cross1% 26 29 ?cross2? %cross2% 27 30 ; 28 31 output out=tmp sum=count; 29 proc sort data=tmp; by agegrp18 %cross1%30 ?cross2? %cross2%31 ;run;32 proc sort data=tmp; 33 by %cross1% %cross2% &STDVAR. ; 34 run; 32 35 proc print data=tmp noobs; 33 36 title1 '---------------------------------'; … … 45 48 retain count 0; 46 49 do 47 agegrp18 = 1 to 18by 1 ;50 &STDVAR. = 1 to &NCAT. by 1 ; 48 51 output; 49 52 end; … … 78 81 by %cross1% 79 82 ?cross2? %cross2% 80 81 agegrp18; 83 &STDVAR. ; 82 84 run; 83 85 proc print data=new_frame noobs; title2 'new_frame, sorted with nodupkey'; run; 84 proc sort data=tmp; by %cross1% %cross2% agegrp18; run; 86 proc sort data=tmp; by %cross1% %cross2% &STDVAR. ; 87 run; 88 89 proc sort data=tmp out=sorted; 90 by %cross1% %cross2% &STDVAR; run; 85 91 data newtmp; 86 merge new_frame tmp; *must list frame dataset first, thentmp;87 by %cross1% %cross2% agegrp18;92 merge new_frame sorted; * tmp, must list frame dataset first, then sorted tmp; 93 by %cross1% %cross2% &STDVAR.; 88 94 drop _TYPE_ _FREQ_ ; 89 95 run; … … 101 107 * cross1 and cross2 totals to -1. ; 102 108 ****************************************************************; 103 data poptmp; format agegrp18%popcross1% %popcross2% 8.; set poptmp; run;109 data poptmp; format &STDVAR %popcross1% %popcross2% 8.; set poptmp; run; 104 110 proc summary data=poptmp; 105 111 var popcount; 106 class agegrp18 %popcross1% %popcross2%; 107 output out=pop sum=popcount; 112 class &STDVAR %popcross1% %popcross2%; 113 output out=pop (drop=_TYPE_ _FREQ_) 114 sum=popcount; 108 115 run; 109 116 data pop; 110 117 set pop; 111 drop _TYPE_ _FREQ_;112 118 proc print data=pop noobs; 113 119 title2 '3. POP - denominator dataset'; … … 123 129 select tmp.*, pop.* 124 130 from tmp left join pop 125 on tmp. agegrp18=pop.agegrp18131 on tmp.&STDVAR.=pop.&STDVAR. 126 132 ?popcross1? and tmp.%cross1%=pop.%popcross1% 127 133 ?popcross2? and tmp.%cross2%=pop.%popcross2% … … 130 136 data numbers; 131 137 set numbers; 132 if agegrp18^=.; *get rid of total rows to stop doubling from pop proc summary;138 if &STDVAR. ^=.; *get rid of total rows to stop doubling from pop proc summary; 133 139 if %cross1%=. then %cross1%=-1; 134 140 ?cross2? if %cross2%=. then %cross2%=-1; … … 157 163 set pop.stdwgts; 158 164 *pop libname is set in .cfg file with the saspop statement; 159 if (stdvar=' AgeGrp18GE25'); *stdvar name is case-sensitive;160 keep agegrp18stdwgt;165 if (stdvar='agepopGE35'); *stdvar name is case-sensitive; 166 keep &STDVAR. stdwgt; 161 167 run; 162 168 proc print data=stdwgt noobs; … … 169 175 ****************************************************************; 170 176 proc sql; 171 create table numbers2 as 172 select numbers.*, stdwgt.stdwgt 173 from numbers left join stdwgt 174 on numbers.agegrp18=stdwgt.agegrp18 175 ; 176 quit; 177 create table numbers2 as 178 select numbers.*, stdwgt.stdwgt 179 from numbers left join stdwgt 180 on numbers.&STDVAR.=stdwgt.&STDVAR. 181 quit; 177 182 proc print data=numbers2 noobs; 178 183 title2 '6. NUMBERS2- Standard POP wgts merged onto dataset'; … … 200 205 var ratewgt rate_var count popcount; 201 206 class %cross1% %cross2%; 202 output out=aarate sum(ratewgt rate_var count popcount)=aarate aarate_var count popcount; 207 output out=aarate (drop=_TYPE_ _FREQ_ ) 208 sum(ratewgt rate_var count popcount)=aarate aarate_var count popcount; 203 209 run; 204 210 data aarate; … … 208 214 proc sort data=aarate; by %cross1% %cross2%; run; 209 215 proc print data=aarate noobs; 210 title2 '8. AARATE - summed across weighted agepopcross-products to get AA rate and';216 title2 '8. AARATE - summed across weighted &STDVAR. cross-products to get AA rate and'; 211 217 title3 'rate variance within each cross-by var'; 212 218 run; … … 217 223 * coded back to '.' after this step. ; 218 224 ****************************************************************; 219 data tmp;225 data rate; 220 226 set aarate; 221 227 if %cross1%=-1 then %cross1%=.; *Recode the statewide totals.; … … 223 229 224 230 if (count>0) then do; 225 rateper=(aarate* 10000);231 rateper=(aarate*&MULTIPLIER.); 226 232 rate_se=sqrt(aarate_var); 227 stderr=(rate_se* 10000);233 stderr=(rate_se*&MULTIPLIER.); 228 234 end; 229 235 if (count<=0) then do; … … 231 237 232 238 rateper=0; 233 stderr=sqrt((3/popcount)*(1-(3/popcount))/popcount)* 10000;239 stderr=sqrt((3/popcount)*(1-(3/popcount))/popcount)*&MULTIPLIER.; 234 240 end; 235 241 t1=(rateper-(1.96*stderr)); … … 250 256 if count>0 then do; 251 257 rse=(stderr/rateper); 252 redflag=put(' -', $14.);253 if rse>.3 then redflag=put('Unstable', $1 4.);254 if rse>.5 then redflag=put('Very Unstable', $1 4.);255 if stderr=. then redflag=put('Unstable', $1 4.);258 redflag=put(' ', $12.); 259 if rse>.3 then redflag=put('Unstable', $12.); 260 if rse>.5 then redflag=put('Very Unstable', $12.); 261 if stderr=. then redflag=put('Unstable', $12.); 256 262 end; 257 if count<=0 then redflag=put('Unstable', $1 4.); *no variance, n=0, rse=div by zero;263 if count<=0 then redflag=put('Unstable', $12.); *no variance, n=0, rse=div by zero; 258 264 run; 259 265 … … 271 277 *******************************************************************; 272 278 data tmp; 273 set tmp;279 set rate; 274 280 if ((0<n<4) and (popcount<5000)) then do; 275 281 n = .A; … … 277 283 LL = put('**', 8.0); 278 284 UL = put('**', 8.0); 285 redflag = put('Suppressed', $12.); 279 286 end; 280 287 proc print data=tmp noobs; title2 '11. TMP - final dataset to pass to IBIS View app'; -
adopters/nm/trunk/src/main/backend_qModules/3.0/_EPHT/water
-
Property
svn:global-ignores
set to
Old
-
Property
svn:global-ignores
set to
Note: See TracChangeset
for help on using the changeset viewer.