Changeset 21568 in main
- Timestamp:
- 09/18/20 12:24:08 (4 months ago)
- Location:
- adopters/md/trunk/src/main/backend_qModules/brfss23
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE2CATDIST17.def
r19544 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE2CATDIST18.def
r19544 r21568 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE3CATDIST15.def
r19541 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE3CATDIST15NoVarLevel.def
r19544 r21568 24 24 popestnum 15.0 25 25 popestdenom 15.0 26 lower7.127 upper7.126 LL 7.1 27 UL 7.1 28 28 redflag 14.0 29 29 --------BoNdArY-------- … … 33 33 popestnum 34 34 popestdenom 35 lower 36 upper 35 LL 36 UL 37 37 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE3CATDIST16.def
r19544 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAACRC.def
r17699 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE40.def
r17621 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE40NoVarLevel.def
r17624 r21568 24 24 popestnum 15.0 25 25 popestdenom 15.0 26 lower7.127 upper7.126 LL 7.1 27 UL 7.1 28 28 redflag 14.0 29 29 --------BoNdArY-------- … … 33 33 popestnum 34 34 popestdenom 35 lower 36 upper 35 LL 36 UL 37 37 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE50.def
r17634 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE50V1.def
r19480 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8.def
r19279 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8NoVarLevel.def
r17583 r21568 24 24 popestnum 15.0 25 25 popestdenom 15.0 26 lower7.127 upper7.126 LL 7.1 27 UL 7.1 28 28 redflag 14.0 29 29 --------BoNdArY-------- … … 33 33 popestnum 34 34 popestdenom 35 lower 36 upper 35 LL 36 UL 37 37 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8NoVarLevelSplitV1.def
r19795 r21568 26 26 popestnum 15.0 27 27 popestdenom 15.0 28 lower7.129 upper7.128 LL 7.1 29 UL 7.1 30 30 redflag 14.0 31 31 --------BoNdArY-------- … … 35 35 popestnum 36 36 popestdenom 37 lower 38 upper 37 LL 38 UL 39 39 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8NoVarLevelSplitV23.def
r19807 r21568 26 26 popestnum 15.0 27 27 popestdenom 15.0 28 lower7.129 upper7.128 LL 7.1 29 UL 7.1 30 30 redflag 14.0 31 31 --------BoNdArY-------- … … 35 35 popestnum 36 36 popestdenom 37 lower 38 upper 37 LL 38 UL 39 39 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8SplitV1.def
r21330 r21568 11 11 --------BoNdArY-------- 12 12 1 script 13 13 OPTIONS nocenter linesize=MAX; 14 14 %include %include%; 15 15 %ageadjrt(%spvar1%,_LNDWTV1); -
adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADistMDGE45.def
r19480 r21568 9 9 --------BoNdArY-------- 10 10 1 script 11 11 OPTIONS nocenter linesize=MAX; 12 12 %include %include%; 13 13 %ageadjrt(%spvar1%,_LLCPWT); … … 23 23 popestnum 15.0 24 24 popestdenom 15.0 25 lower7.126 upper7.125 LL 7.1 26 UL 7.1 27 27 redflag 14.0 28 28 --------BoNdArY-------- … … 32 32 popestnum 33 33 popestdenom 34 lower 35 upper 34 LL 35 UL 36 36 --------BoNdArY-------- -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE2CATDIST17.sas
r19541 r21568 280 280 * age groups that ARE represented in the tmp dataset, and recomputes ; 281 281 * (normalizes) the AA weights so that they sum to 1.0. ; 282 * MD dist1 0 GE40compute from NCHS Statnote20 using spreadheet mentioned above ;282 * MD dist17 compute from NCHS Statnote20 using spreadheet mentioned above ; 283 283 *******************************************************************************; 284 284 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)'; … … 286 286 set work.domain; 287 287 drop DomainLabel VarLabel VarName; 288 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate ;288 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate Part of ZW hi_iq_func; 289 289 run; 290 290 proc print data=norm ; run; … … 376 376 run; 377 377 proc print data=tmp1 noobs; run; 378 378 379 379 ***** RATE *******************************************************************; 380 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;380 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 381 381 ******************************************************************************; 382 382 title2 'RATE: RATES COMPUTED'; … … 384 384 set tmp1; 385 385 386 stderr=sqrt(wgt_var); 387 f=log(wgt_percent)-log(1-wgt_percent); 388 s=stderr/(wgt_percent*(1-wgt_percent)); 389 Lf=f-1.96*s; 390 Uf=f+1.96*s; 391 392 lower=exp(Lf)/(1+exp(Lf)); 393 upper=exp(Uf)/(1+exp(Uf)); 386 /********** 387 OLD Asymmetirec? 388 f=log(wgt_percent)-log(1-wgt_percent); 389 s=stderr/(wgt_percent*(1-wgt_percent)); 390 Lf=f-1.96*s; 391 Uf=f+1.96*s; 392 393 lower=exp(Lf)/(1+exp(Lf)); 394 upper=exp(Uf)/(1+exp(Uf)); 395 drop f s Lf Uf wgt_var; 396 *********/ 397 398 399 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 400 /* commenting out, not sure if I need to do theis 401 if (wgt_percent<=0) then do; 402 wgt_percent=0; 403 wgt_percent=0; 404 wgt_var=0; *is this correct, and need to test for it in suppression below; 405 stderr=0; 406 LL=put(0, 7.1); 407 UL=put(0, 7.1); 408 end; 409 */ 410 /* if (0<wgt_percent<1) then do; */ 411 stderr=sqrt(wgt_var); 412 t1=(wgt_percent-(1.96*stderr)); 413 if (t1<0) then t1=0; 414 LL=t1; 415 UL=(wgt_percent+(1.96*stderr)); 416 if UL > 100 then UL = 100; 417 /* end; */ 418 419 if (wgt_percent=1) then do; 420 wgt_percent=0; 421 wgt_var=0; *is this correct, and need to test for it in suppression below; 422 stderr=0; 423 LL=put(0, 7.1); 424 UL=put(0, 7.1); 425 end; 426 427 LL=compress(LL); 428 UL=compress(UL); 429 394 430 if %cross1%=. then delete; 395 431 else if %cross1%='' then delete; 396 432 ?cross2? if %cross2%=. then delete; 397 433 ?cross2? else if %cross2%='' then delete; 398 drop f s Lf Uf wgt_var; 434 399 435 run; 400 436 … … 408 444 409 445 ***** SAMPLEN ****************************************************************; 410 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;446 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 411 447 ******************************************************************************; 412 448 title2 'SAMPLEN: the n from all the varname totals'; … … 437 473 ***********Used by MD, they want popestdenom, not samplen********; 438 474 *****************************************************************; 439 proc contents data=tmpall; run; 475 /* proc contents data=tmpall; run; TEST */ 440 476 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 441 477 var Sum; … … 485 521 * redflag is the statistical stability indicator, based on ; 486 522 * the relative standard error (RSE, or coefficient of variation. ; 487 * now using wgt_percent which is mean*weight to calculate RSE;523 * now using wgt_percent which is mean*weight to calculate RSE ; 488 524 **************************************************************************; 489 data rse;525 data Stability; 490 526 set tmp6; 491 527 492 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 493 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 528 redflag=put('Stable', $14.); 529 530 RSE=(StdErr/wgt_percent); 531 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 532 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 494 533 495 redflag=put('Stable', $14.); 496 if rse>.3 then redflag=put('Unstable', $14.); 497 if SampleN in (0 1) then redflag=put('No Variance', $14.); 534 /* RSE=(StdErr/wgt_percent); */ 535 536 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 537 if RSE = . then RSE = 0; * is this reasonable?; 538 539 if RSE >.3 then redflag=put('Unstable', $14.); 540 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 541 542 if &varname. = '.' then delete; 543 544 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 545 run; 546 547 data Stability; 548 set Stability; 498 549 if %cross1%=-1 then %cross1%=.; 499 550 else if %cross1%='tot' then %cross1%='.'; … … 507 558 508 559 ageadj_percent=100*wgt_percent; 509 lower=100*lower; 510 upper=100*upper; 511 512 run; 513 560 LL=100*LL; 561 UL=100*UL; 562 563 /* ask Lois about the following */ 564 565 if UL > 100 then UL = 100; 566 567 run; 568 /* do we need these sorts? I don't think so */ 514 569 proc sort data=rate; 515 570 by %cross1% … … 517 572 ; 518 573 run; 519 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 574 575 proc sort data=Stability; 576 by %cross1% 577 ?cross2? %cross2% 578 ; 579 run; 580 581 582 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 520 583 521 584 ***** Maryland Small Numbers Rule ****************************************; … … 530 593 * suppressed_variables code at the end of this file to work. ; 531 594 **************************************************************************; 532 title2 'TMP: rate with cell suppression'; 595 596 533 597 data tmp; 534 set rse; 535 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 536 if (0<SampleN<30) OR (rse >.3) then do; 537 ageadj_percent = .A; 538 lower = .A; 539 upper = .A; 540 popestnum = .A; 541 popestdenom = .A; 542 redflag=put('Not Reportable', $14.); 543 end; 598 set Stability; 599 600 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 601 if &varname in (%spvar2% .); 602 if (0<SampleN < 50) OR (RSE >.3) then do; 603 ageadj_percent = .A; 604 LL = .A; 605 UL = .A; 606 popestnum = .A; 607 popestdenom = .A; 608 redflag=put('Not Reportable', $14.); 609 end; 544 610 proc print data=tmp noobs; title2 'final tmp'; run; 545 611 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE2CATDIST18.sas
r19541 r21568 280 280 * age groups that ARE represented in the tmp dataset, and recomputes ; 281 281 * (normalizes) the AA weights so that they sum to 1.0. ; 282 * MD dist1 0 GE40compute from NCHS Statnote20 using spreadheet mentioned above ;282 * MD dist18 compute from NCHS Statnote20 using spreadheet mentioned above ; 283 283 *******************************************************************************; 284 284 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)'; … … 286 286 set work.domain; 287 287 drop DomainLabel VarLabel VarName; 288 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate ;288 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate Part of ZW hi_iq_func; 289 289 run; 290 290 proc print data=norm ; run; … … 376 376 run; 377 377 proc print data=tmp1 noobs; run; 378 378 379 379 ***** RATE *******************************************************************; 380 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;380 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 381 381 ******************************************************************************; 382 382 title2 'RATE: RATES COMPUTED'; … … 384 384 set tmp1; 385 385 386 stderr=sqrt(wgt_var); 387 f=log(wgt_percent)-log(1-wgt_percent); 388 s=stderr/(wgt_percent*(1-wgt_percent)); 389 Lf=f-1.96*s; 390 Uf=f+1.96*s; 391 392 lower=exp(Lf)/(1+exp(Lf)); 393 upper=exp(Uf)/(1+exp(Uf)); 386 /********** 387 OLD Asymmetirec? 388 f=log(wgt_percent)-log(1-wgt_percent); 389 s=stderr/(wgt_percent*(1-wgt_percent)); 390 Lf=f-1.96*s; 391 Uf=f+1.96*s; 392 393 lower=exp(Lf)/(1+exp(Lf)); 394 upper=exp(Uf)/(1+exp(Uf)); 395 drop f s Lf Uf wgt_var; 396 *********/ 397 398 399 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 400 /* commenting out, not sure if I need to do theis 401 if (wgt_percent<=0) then do; 402 wgt_percent=0; 403 wgt_percent=0; 404 wgt_var=0; *is this correct, and need to test for it in suppression below; 405 stderr=0; 406 LL=put(0, 7.1); 407 UL=put(0, 7.1); 408 end; 409 */ 410 /* if (0<wgt_percent<1) then do; */ 411 stderr=sqrt(wgt_var); 412 t1=(wgt_percent-(1.96*stderr)); 413 if (t1<0) then t1=0; 414 LL=t1; 415 UL=(wgt_percent+(1.96*stderr)); 416 if UL > 100 then UL = 100; 417 /* end; */ 418 419 if (wgt_percent=1) then do; 420 wgt_percent=0; 421 wgt_var=0; *is this correct, and need to test for it in suppression below; 422 stderr=0; 423 LL=put(0, 7.1); 424 UL=put(0, 7.1); 425 end; 426 427 LL=compress(LL); 428 UL=compress(UL); 429 394 430 if %cross1%=. then delete; 395 431 else if %cross1%='' then delete; 396 432 ?cross2? if %cross2%=. then delete; 397 433 ?cross2? else if %cross2%='' then delete; 398 drop f s Lf Uf wgt_var; 434 399 435 run; 400 436 … … 408 444 409 445 ***** SAMPLEN ****************************************************************; 410 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;446 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 411 447 ******************************************************************************; 412 448 title2 'SAMPLEN: the n from all the varname totals'; … … 437 473 ***********Used by MD, they want popestdenom, not samplen********; 438 474 *****************************************************************; 439 proc contents data=tmpall; run; 475 /* proc contents data=tmpall; run; TEST */ 440 476 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 441 477 var Sum; … … 485 521 * redflag is the statistical stability indicator, based on ; 486 522 * the relative standard error (RSE, or coefficient of variation. ; 487 * now using wgt_percent which is mean*weight to calculate RSE;523 * now using wgt_percent which is mean*weight to calculate RSE ; 488 524 **************************************************************************; 489 data rse;525 data Stability; 490 526 set tmp6; 491 527 492 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 493 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 528 redflag=put('Stable', $14.); 529 530 RSE=(StdErr/wgt_percent); 531 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 532 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 494 533 495 redflag=put('Stable', $14.); 496 if rse>.3 then redflag=put('Unstable', $14.); 497 if SampleN in (0 1) then redflag=put('No Variance', $14.); 534 /* RSE=(StdErr/wgt_percent); */ 535 536 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 537 if RSE = . then RSE = 0; * is this reasonable?; 538 539 if RSE >.3 then redflag=put('Unstable', $14.); 540 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 541 542 if &varname. = '.' then delete; 543 544 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 545 run; 546 547 data Stability; 548 set Stability; 498 549 if %cross1%=-1 then %cross1%=.; 499 550 else if %cross1%='tot' then %cross1%='.'; … … 507 558 508 559 ageadj_percent=100*wgt_percent; 509 lower=100*lower; 510 upper=100*upper; 511 512 run; 513 560 LL=100*LL; 561 UL=100*UL; 562 563 /* ask Lois about the following */ 564 565 if UL > 100 then UL = 100; 566 567 run; 568 /* do we need these sorts? I don't think so */ 514 569 proc sort data=rate; 515 570 by %cross1% … … 517 572 ; 518 573 run; 519 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 574 575 proc sort data=Stability; 576 by %cross1% 577 ?cross2? %cross2% 578 ; 579 run; 580 581 582 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 520 583 521 584 ***** Maryland Small Numbers Rule ****************************************; … … 532 595 title2 'TMP: rate with cell suppression'; 533 596 data tmp; 534 set rse; 535 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 536 if (0<SampleN<30) OR (rse >.3) then do; 537 ageadj_percent = .A; 538 lower = .A; 539 upper = .A; 540 popestnum = .A; 541 popestdenom = .A; 542 redflag=put('Not Reportable', $14.); 543 end; 597 set Stability; 598 599 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 600 if &varname in (%spvar2% .); 601 if (0<SampleN < 50) OR (RSE >.3) then do; 602 ageadj_percent = .A; 603 LL = .A; 604 UL = .A; 605 popestnum = .A; 606 popestdenom = .A; 607 redflag=put('Not Reportable', $14.); 608 end; 544 609 proc print data=tmp noobs; title2 'final tmp'; run; 545 610 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE3CATDIST15.sas
r19541 r21568 281 281 * age groups that ARE represented in the tmp dataset, and recomputes ; 282 282 * (normalizes) the AA weights so that they sum to 1.0. ; 283 * MD dist1 0 GE40compute from NCHS Statnote20 using spreadheet mentioned above ;283 * MD dist15 compute from NCHS Statnote20 using spreadheet mentioned above ; 284 284 *******************************************************************************; 285 285 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)'; … … 287 287 set work.domain; 288 288 drop DomainLabel VarLabel VarName; 289 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate ;289 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate Part of ZW hi_iq_func; 290 290 run; 291 291 proc print data=norm ; run; … … 381 381 run; 382 382 proc print data=tmp1 noobs; run; 383 383 384 384 ***** RATE *******************************************************************; 385 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;385 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 386 386 ******************************************************************************; 387 387 title2 'RATE: RATES COMPUTED'; … … 389 389 set tmp1; 390 390 391 stderr=sqrt(wgt_var); 392 f=log(wgt_percent)-log(1-wgt_percent); 393 s=stderr/(wgt_percent*(1-wgt_percent)); 394 Lf=f-1.96*s; 395 Uf=f+1.96*s; 396 397 lower=exp(Lf)/(1+exp(Lf)); 398 upper=exp(Uf)/(1+exp(Uf)); 391 /********** 392 OLD Asymmetirec? 393 f=log(wgt_percent)-log(1-wgt_percent); 394 s=stderr/(wgt_percent*(1-wgt_percent)); 395 Lf=f-1.96*s; 396 Uf=f+1.96*s; 397 398 lower=exp(Lf)/(1+exp(Lf)); 399 upper=exp(Uf)/(1+exp(Uf)); 400 drop f s Lf Uf wgt_var; 401 *********/ 402 403 404 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 405 /* commenting out, not sure if I need to do theis 406 if (wgt_percent<=0) then do; 407 wgt_percent=0; 408 wgt_percent=0; 409 wgt_var=0; *is this correct, and need to test for it in suppression below; 410 stderr=0; 411 LL=put(0, 7.1); 412 UL=put(0, 7.1); 413 end; 414 */ 415 /* if (0<wgt_percent<1) then do; */ 416 stderr=sqrt(wgt_var); 417 t1=(wgt_percent-(1.96*stderr)); 418 if (t1<0) then t1=0; 419 LL=t1; 420 UL=(wgt_percent+(1.96*stderr)); 421 if UL > 100 then UL = 100; 422 /* end; */ 423 424 if (wgt_percent=1) then do; 425 wgt_percent=0; 426 wgt_var=0; *is this correct, and need to test for it in suppression below; 427 stderr=0; 428 LL=put(0, 7.1); 429 UL=put(0, 7.1); 430 end; 431 432 LL=compress(LL); 433 UL=compress(UL); 434 399 435 if %cross1%=. then delete; 400 436 else if %cross1%='' then delete; 401 437 ?cross2? if %cross2%=. then delete; 402 438 ?cross2? else if %cross2%='' then delete; 403 drop f s Lf Uf wgt_var; 439 404 440 run; 405 441 … … 413 449 414 450 ***** SAMPLEN ****************************************************************; 415 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;451 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 416 452 ******************************************************************************; 417 453 title2 'SAMPLEN: the n from all the varname totals'; … … 442 478 ***********Used by MD, they want popestdenom, not samplen********; 443 479 *****************************************************************; 444 proc contents data=tmpall; run; 480 /* proc contents data=tmpall; run; TEST */ 445 481 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 446 482 var Sum; … … 490 526 * redflag is the statistical stability indicator, based on ; 491 527 * the relative standard error (RSE, or coefficient of variation. ; 492 * now using wgt_percent which is mean*weight to calculate RSE;528 * now using wgt_percent which is mean*weight to calculate RSE ; 493 529 **************************************************************************; 494 data rse;530 data Stability; 495 531 set tmp6; 496 532 497 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 498 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 533 redflag=put('Stable', $14.); 534 535 RSE=(StdErr/wgt_percent); 536 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 537 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 499 538 500 redflag=put('Stable', $14.); 501 if rse>.3 then redflag=put('Unstable', $14.); 502 if SampleN in (0 1) then redflag=put('No Variance', $14.); 539 /* RSE=(StdErr/wgt_percent); */ 540 541 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 542 if RSE = . then RSE = 0; * is this reasonable?; 543 544 if RSE >.3 then redflag=put('Unstable', $14.); 545 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 546 547 if &varname. = '.' then delete; 548 549 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 550 run; 551 552 data Stability; 553 set Stability; 503 554 if %cross1%=-1 then %cross1%=.; 504 555 else if %cross1%='tot' then %cross1%='.'; … … 512 563 513 564 ageadj_percent=100*wgt_percent; 514 lower=100*lower; 515 upper=100*upper; 516 517 run; 518 565 LL=100*LL; 566 UL=100*UL; 567 568 /* ask Lois about the following */ 569 570 if UL > 100 then UL = 100; 571 572 run; 573 /* do we need these sorts? I don't think so */ 519 574 proc sort data=rate; 520 575 by %cross1% … … 522 577 ; 523 578 run; 524 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 579 580 proc sort data=Stability; 581 by %cross1% 582 ?cross2? %cross2% 583 ; 584 run; 585 586 587 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 525 588 526 589 ***** Maryland Small Numbers Rule ****************************************; … … 537 600 title2 'TMP: rate with cell suppression'; 538 601 data tmp; 539 set rse; 540 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 541 if (0<SampleN<30) OR (rse >.3) then do; 542 ageadj_percent = .A; 543 lower = .A; 544 upper = .A; 545 popestnum = .A; 546 popestdenom = .A; 547 redflag=put('Not Reportable', $14.); 548 end; 602 set Stability; 603 604 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 605 if &varname in (%spvar2% .); 606 if (0<SampleN < 50) OR (RSE >.3) then do; 607 ageadj_percent = .A; 608 LL = .A; 609 UL = .A; 610 popestnum = .A; 611 popestdenom = .A; 612 redflag=put('Not Reportable', $14.); 613 end; 549 614 proc print data=tmp noobs; title2 'final tmp'; run; 550 615 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE3CATDIST15NoVarLevel.sas
r19544 r21568 129 129 ; 130 130 set work.domain; 131 drop DomainLabel VarLabel VarName;131 *drop DomainLabel VarLabel VarName; 132 132 %cross1%=-1; 133 133 … … 158 158 proc print data=stats; title1 '=================='; title2 'SurveyMeans1 stats'; run; 159 159 proc print data=domain; title1 '=================='; title2 'SurveyMeans1 domain'; run; 160 160 161 161 /* 162 162 *** PROC SURVEYMEANS2 - CELLS ***************************************************; … … 182 182 run; 183 183 proc print data=work.domain; title1 '================='; title2 'SURVEYMEANS2: domain from Cells'; run; 184 184 185 185 proc sort data=work.domain; 186 186 by %cross1% AGE3CATDIST15 ; 187 187 run; 188 188 189 189 ***** TMPALL *****************************************************************; 190 190 * CONCATENATE TOTAL ROWS ONTO NEW DOMAIN DATASET ; … … 203 203 proc print data=tmpall noobs; run; 204 204 205 ***** NORMALIZE *************************************************************** ;206 * Now, go back to CROSS1 CROSS2 domain records and compute new weights that ;207 * are normalized so that they sum to 1.0. ;208 * What is the problem? Let us say the user filters or stratifies the dataset ;209 * to small populations, like by race/ethnicity and county, such that there ;210 * are not survey records in all race X county X age groups. If some cells are ;211 * empty, the AA weights will not sum to 1.0 so we do this step that finds the ;212 * age groups that ARE represented in the tmp dataset, and recomputes ;213 * (normalizes) the AA weights so that they sum to 1.0. ;214 215 ******************************************************************************* ;205 ***** NORMALIZE *******************************************************************; 206 * Now, go back to CROSS1 CROSS2 domain records and compute new weights that ; 207 * are normalized so that they sum to 1.0. ; 208 * What is the problem? Let us say the user filters or stratifies the dataset ; 209 * to small populations, like by race/ethnicity and county, such that there ; 210 * are not survey records in all race X county X age groups. If some cells are ; 211 * empty, the AA weights will not sum to 1.0 so we do this step that finds the ; 212 * age groups that ARE represented in the tmp dataset, and recomputes ; 213 * (normalizes) the AA weights so that they sum to 1.0. ; 214 * MD distribution 15 compute from NCHS Statnote20 using spreadheet mentioned above; 215 ***********************************************************************************; 216 216 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)'; 217 217 data norm; 218 218 set work.domain; 219 drop DomainLabel VarLabel VarName;220 /* n ext step invokes one of ZW's */219 *drop DomainLabel VarLabel VarName; 220 /* not quite sure what next step does */ 221 221 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate; 222 222 run; … … 314 314 run; 315 315 proc print data=tmp1 noobs; run; 316 316 317 317 ***** RATE *******************************************************************; 318 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;318 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 319 319 ******************************************************************************; 320 320 title2 'RATE: RATES COMPUTED'; … … 322 322 set tmp1; 323 323 324 stderr=sqrt(wgt_var); 325 f=log(wgt_percent)-log(1-wgt_percent); 326 s=stderr/(wgt_percent*(1-wgt_percent)); 327 Lf=f-1.96*s; 328 Uf=f+1.96*s; 329 330 lower=exp(Lf)/(1+exp(Lf)); 331 upper=exp(Uf)/(1+exp(Uf)); 324 /********** 325 OLD Asymmetirec? 326 f=log(wgt_percent)-log(1-wgt_percent); 327 s=stderr/(wgt_percent*(1-wgt_percent)); 328 Lf=f-1.96*s; 329 Uf=f+1.96*s; 330 331 lower=exp(Lf)/(1+exp(Lf)); 332 upper=exp(Uf)/(1+exp(Uf)); 333 drop f s Lf Uf wgt_var; 334 *********/ 335 336 337 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 338 /* commenting out, not sure if I need to do theis 339 if (wgt_percent<=0) then do; 340 wgt_percent=0; 341 wgt_percent=0; 342 wgt_var=0; *is this correct, and need to test for it in suppression below; 343 stderr=0; 344 LL=put(0, 7.1); 345 UL=put(0, 7.1); 346 end; 347 */ 348 /* if (0<wgt_percent<1) then do; */ 349 stderr=sqrt(wgt_var); 350 t1=(wgt_percent-(1.96*stderr)); 351 if (t1<0) then t1=0; 352 LL=t1; 353 UL=(wgt_percent+(1.96*stderr)); 354 if UL > 100 then UL = 100; 355 /* end; */ 356 357 if (wgt_percent=1) then do; 358 wgt_percent=0; 359 wgt_var=0; *is this correct, and need to test for it in suppression below; 360 stderr=0; 361 LL=put(0, 7.1); 362 UL=put(0, 7.1); 363 end; 364 365 LL=compress(LL); 366 UL=compress(UL); 367 332 368 if %cross1%=. then delete; 333 369 else if %cross1%='' then delete; … … 346 382 347 383 ***** SAMPLEN ****************************************************************; 348 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;384 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 349 385 ******************************************************************************; 350 386 title2 'SAMPLEN: the n from all the varname totals'; … … 420 456 * redflag is the statistical stability indicator, based on ; 421 457 * the relative standard error (RSE, or coefficient of variation. ; 422 * now using wgt_percent which is mean*weight to calculate RSE;458 * now using wgt_percent which is mean*weight to calculate RSE ; 423 459 **************************************************************************; 424 data rse;460 data Stability; 425 461 set tmp6; 426 462 427 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 428 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 463 redflag=put('Stable', $14.); 464 465 RSE=(StdErr/wgt_percent); 466 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 467 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 468 429 469 430 redflag=put('Stable', $14.); 431 if rse>.3 then redflag=put('Unstable', $14.); 432 if SampleN in (0 1) then redflag=put('No Variance', $14.); 470 /* RSE=(StdErr/wgt_percent); */ 471 472 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 473 if RSE = . then RSE = 0; * is this reasonable?; 474 475 if RSE >.3 then redflag=put('Unstable', $14.); 476 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 477 478 if &varname. = '.' then delete; 479 480 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 481 run; 482 483 data Stability; 484 set Stability; 433 485 if %cross1%=-1 then %cross1%=.; 434 486 else if %cross1%='tot' then %cross1%='.'; … … 442 494 443 495 ageadj_percent=100*wgt_percent; 444 lower=100*lower; 445 upper=100*upper; 446 447 run; 448 496 LL=100*LL; 497 UL=100*UL; 498 499 /* ask Lois about the following */ 500 501 if UL > 100 then UL = 100; 502 503 run; 504 /* do we need these sorts? I don't think so */ 449 505 proc sort data=rate; 450 506 by %cross1% 451 452 507 ; 453 508 run; 454 proc print data=rse noobs; title2 'RSE: RSE computed, no totals'; run; 509 510 proc sort data=Stability; 511 by %cross1% 512 ?cross2? %cross2% 513 ; 514 run; 515 516 517 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 455 518 456 519 ***** Maryland Small Numbers Rule ****************************************; … … 467 530 title2 'TMP: rate with cell suppression'; 468 531 data tmp; 469 set rse; 470 *if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 471 if (0<SampleN<30) OR (rse >.3) then do; 472 ageadj_percent = .A; 473 lower = .A; 474 upper = .A; 475 popestnum = .A; 476 popestdenom = .A; 477 redflag=put('Not Reportable', $14.); 478 end; 532 set Stability; 533 534 /*Next line NOT USED for NoVarLevel, it is the value for the indicator dimension, (FOCUSLEVEL) passed in by the URL */ 535 /* if &varname in (%spvar2% .); */ 536 537 if (0<SampleN < 50) OR (RSE >.3) then do; 538 ageadj_percent = .A; 539 LL = .A; 540 UL = .A; 541 popestnum = .A; 542 popestdenom = .A; 543 redflag=put('Not Reportable', $14.); 544 end; 479 545 proc print data=tmp noobs; title2 'final tmp'; run; 480 546 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE3CATDIST16.sas
r19541 r21568 272 272 proc print data=tmpall noobs; run; 273 273 274 ***** NORMALIZE *************************************************************** ;275 * Now, go back to CROSS1 CROSS2 domain records and compute new weights that ;276 * are normalized so that they sum to 1.0. ;277 * What is the problem? Let us say the user filters or stratifies the dataset ;278 * to small populations, like by race/ethnicity and county, such that there ;279 * are not survey records in all race X county X age groups. If some cells are ;280 * empty, the AA weights will not sum to 1.0 so we do this step that finds the ;281 * age groups that ARE represented in the tmp dataset, and recomputes ;282 * (normalizes) the AA weights so that they sum to 1.0. ;283 * MD dist10 GE40compute from NCHS Statnote20 using spreadheet mentioned above ;284 ******************************************************************************* ;274 ***** NORMALIZE *******************************************************************; 275 * Now, go back to CROSS1 CROSS2 domain records and compute new weights that ; 276 * are normalized so that they sum to 1.0. ; 277 * What is the problem? Let us say the user filters or stratifies the dataset ; 278 * to small populations, like by race/ethnicity and county, such that there ; 279 * are not survey records in all race X county X age groups. If some cells are ; 280 * empty, the AA weights will not sum to 1.0 so we do this step that finds the ; 281 * age groups that ARE represented in the tmp dataset, and recomputes ; 282 * (normalizes) the AA weights so that they sum to 1.0. ; 283 * MD distribution16 compute from NCHS Statnote20 using spreadheet mentioned above ; 284 ***********************************************************************************; 285 285 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)'; 286 286 data norm; 287 287 set work.domain; 288 288 drop DomainLabel VarLabel VarName; 289 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate ;289 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate Part of ZW hi_iq_func; 290 290 run; 291 291 proc print data=norm ; run; … … 381 381 run; 382 382 proc print data=tmp1 noobs; run; 383 383 384 384 ***** RATE *******************************************************************; 385 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;385 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 386 386 ******************************************************************************; 387 387 title2 'RATE: RATES COMPUTED'; … … 389 389 set tmp1; 390 390 391 stderr=sqrt(wgt_var); 392 f=log(wgt_percent)-log(1-wgt_percent); 393 s=stderr/(wgt_percent*(1-wgt_percent)); 394 Lf=f-1.96*s; 395 Uf=f+1.96*s; 396 397 lower=exp(Lf)/(1+exp(Lf)); 398 upper=exp(Uf)/(1+exp(Uf)); 391 /********** 392 OLD Asymmetirec? 393 f=log(wgt_percent)-log(1-wgt_percent); 394 s=stderr/(wgt_percent*(1-wgt_percent)); 395 Lf=f-1.96*s; 396 Uf=f+1.96*s; 397 398 lower=exp(Lf)/(1+exp(Lf)); 399 upper=exp(Uf)/(1+exp(Uf)); 400 drop f s Lf Uf wgt_var; 401 *********/ 402 403 404 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 405 /* commenting out, not sure if I need to do theis 406 if (wgt_percent<=0) then do; 407 wgt_percent=0; 408 wgt_percent=0; 409 wgt_var=0; *is this correct, and need to test for it in suppression below; 410 stderr=0; 411 LL=put(0, 7.1); 412 UL=put(0, 7.1); 413 end; 414 */ 415 /* if (0<wgt_percent<1) then do; */ 416 stderr=sqrt(wgt_var); 417 t1=(wgt_percent-(1.96*stderr)); 418 if (t1<0) then t1=0; 419 LL=t1; 420 UL=(wgt_percent+(1.96*stderr)); 421 if UL > 100 then UL = 100; 422 /* end; */ 423 424 if (wgt_percent=1) then do; 425 wgt_percent=0; 426 wgt_var=0; *is this correct, and need to test for it in suppression below; 427 stderr=0; 428 LL=put(0, 7.1); 429 UL=put(0, 7.1); 430 end; 431 432 LL=compress(LL); 433 UL=compress(UL); 434 399 435 if %cross1%=. then delete; 400 436 else if %cross1%='' then delete; 401 437 ?cross2? if %cross2%=. then delete; 402 438 ?cross2? else if %cross2%='' then delete; 403 drop f s Lf Uf wgt_var; 439 404 440 run; 405 441 … … 413 449 414 450 ***** SAMPLEN ****************************************************************; 415 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;451 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 416 452 ******************************************************************************; 417 453 title2 'SAMPLEN: the n from all the varname totals'; … … 442 478 ***********Used by MD, they want popestdenom, not samplen********; 443 479 *****************************************************************; 444 proc contents data=tmpall; run; 480 /* proc contents data=tmpall; run; TEST */ 445 481 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 446 482 var Sum; … … 490 526 * redflag is the statistical stability indicator, based on ; 491 527 * the relative standard error (RSE, or coefficient of variation. ; 492 * now using wgt_percent which is mean*weight to calculate RSE;528 * now using wgt_percent which is mean*weight to calculate RSE ; 493 529 **************************************************************************; 494 data rse;530 data Stability; 495 531 set tmp6; 496 532 497 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 498 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 533 redflag=put('Stable', $14.); 534 535 RSE=(StdErr/wgt_percent); 536 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 537 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 499 538 500 redflag=put('Stable', $14.); 501 if rse>.3 then redflag=put('Unstable', $14.); 502 if SampleN in (0 1) then redflag=put('No Variance', $14.); 539 /* RSE=(StdErr/wgt_percent); */ 540 541 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 542 if RSE = . then RSE = 0; * is this reasonable?; 543 544 if RSE >.3 then redflag=put('Unstable', $14.); 545 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 546 547 if &varname. = '.' then delete; 548 549 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 550 run; 551 552 data Stability; 553 set Stability; 503 554 if %cross1%=-1 then %cross1%=.; 504 555 else if %cross1%='tot' then %cross1%='.'; … … 512 563 513 564 ageadj_percent=100*wgt_percent; 514 lower=100*lower; 515 upper=100*upper; 516 517 run; 518 565 LL=100*LL; 566 UL=100*UL; 567 568 /* ask Lois about the following */ 569 570 if UL > 100 then UL = 100; 571 572 run; 573 /* do we need these sorts? I don't think so */ 519 574 proc sort data=rate; 520 575 by %cross1% … … 522 577 ; 523 578 run; 524 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 579 580 proc sort data=Stability; 581 by %cross1% 582 ?cross2? %cross2% 583 ; 584 run; 585 586 587 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 525 588 526 589 ***** Maryland Small Numbers Rule ****************************************; … … 537 600 title2 'TMP: rate with cell suppression'; 538 601 data tmp; 539 set rse; 540 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 541 if (0<SampleN<30) OR (rse >.3) then do; 542 ageadj_percent = .A; 543 lower = .A; 544 upper = .A; 545 popestnum = .A; 546 popestdenom = .A; 547 redflag=put('Not Reportable', $14.); 548 end; 602 set Stability; 603 604 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 605 if &varname in (%spvar2% .); 606 if (0<SampleN < 50) OR (RSE >.3) then do; 607 ageadj_percent = .A; 608 LL = .A; 609 UL = .A; 610 popestnum = .A; 611 popestdenom = .A; 612 redflag=put('Not Reportable', $14.); 613 end; 549 614 proc print data=tmp noobs; title2 'final tmp'; run; 550 615 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateCRC.sas
r17699 r21568 257 257 * CONCATENATE TOTAL ROWS ONTO NEW DOMAIN DATASET ; 258 258 * work.domain is the new domain output, totaltemp is the new one with the ; 259 * cross1 and cross2 output. 259 * cross1 and cross2 output. ; 260 260 ******************************************************************************; 261 261 title2 'TMPALL: stats for domain vars with totals added'; … … 285 285 set work.domain; 286 286 drop DomainLabel VarLabel VarName; 287 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate ;287 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate Part of ZW hi_iq_func; 288 288 run; 289 289 proc print data=norm ; run; … … 375 375 run; 376 376 proc print data=tmp1 noobs; run; 377 377 378 378 ***** RATE *******************************************************************; 379 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;379 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 380 380 ******************************************************************************; 381 381 title2 'RATE: RATES COMPUTED'; … … 383 383 set tmp1; 384 384 385 stderr=sqrt(wgt_var); 386 f=log(wgt_percent)-log(1-wgt_percent); 387 s=stderr/(wgt_percent*(1-wgt_percent)); 388 Lf=f-1.96*s; 389 Uf=f+1.96*s; 390 391 lower=exp(Lf)/(1+exp(Lf)); 392 upper=exp(Uf)/(1+exp(Uf)); 385 /********** 386 OLD Asymmetirec? 387 f=log(wgt_percent)-log(1-wgt_percent); 388 s=stderr/(wgt_percent*(1-wgt_percent)); 389 Lf=f-1.96*s; 390 Uf=f+1.96*s; 391 392 lower=exp(Lf)/(1+exp(Lf)); 393 upper=exp(Uf)/(1+exp(Uf)); 394 drop f s Lf Uf wgt_var; 395 *********/ 396 397 398 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 399 /* commenting out, not sure if I need to do theis 400 if (wgt_percent<=0) then do; 401 wgt_percent=0; 402 wgt_percent=0; 403 wgt_var=0; *is this correct, and need to test for it in suppression below; 404 stderr=0; 405 LL=put(0, 7.1); 406 UL=put(0, 7.1); 407 end; 408 */ 409 /* if (0<wgt_percent<1) then do; */ 410 stderr=sqrt(wgt_var); 411 t1=(wgt_percent-(1.96*stderr)); 412 if (t1<0) then t1=0; 413 LL=t1; 414 UL=(wgt_percent+(1.96*stderr)); 415 if UL > 100 then UL = 100; 416 /* end; */ 417 418 if (wgt_percent=1) then do; 419 wgt_percent=0; 420 wgt_var=0; *is this correct, and need to test for it in suppression below; 421 stderr=0; 422 LL=put(0, 7.1); 423 UL=put(0, 7.1); 424 end; 425 426 LL=compress(LL); 427 UL=compress(UL); 428 393 429 if %cross1%=. then delete; 394 430 else if %cross1%='' then delete; 395 431 ?cross2? if %cross2%=. then delete; 396 432 ?cross2? else if %cross2%='' then delete; 397 drop f s Lf Uf wgt_var; 433 398 434 run; 399 435 … … 436 472 ***********Used by MD, they want popestdenom, not samplen********; 437 473 *****************************************************************; 438 proc contents data=tmpall; run; 474 /* proc contents data=tmpall; run; TEST */ 439 475 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 440 476 var Sum; … … 484 520 * redflag is the statistical stability indicator, based on ; 485 521 * the relative standard error (RSE, or coefficient of variation. ; 486 * now using wgt_percent which is mean*weight to calculate RSE;522 * now using wgt_percent which is mean*weight to calculate RSE ; 487 523 **************************************************************************; 488 data rse;524 data Stability; 489 525 set tmp6; 490 526 491 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 492 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 527 redflag=put('Stable', $14.); 528 529 RSE=(StdErr/wgt_percent); 530 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 531 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 493 532 494 redflag=put('Stable', $14.); 495 if rse>.3 then redflag=put('Unstable', $14.); 496 if SampleN in (0 1) then redflag=put('No Variance', $14.); 533 /* RSE=(StdErr/wgt_percent); */ 534 535 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 536 if RSE = . then RSE = 0; * is this reasonable?; 537 538 if RSE >.3 then redflag=put('Unstable', $14.); 539 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 540 541 if &varname. = '.' then delete; 542 543 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 544 run; 545 546 data Stability; 547 set Stability; 497 548 if %cross1%=-1 then %cross1%=.; 498 549 else if %cross1%='tot' then %cross1%='.'; … … 506 557 507 558 ageadj_percent=100*wgt_percent; 508 lower=100*lower; 509 upper=100*upper; 510 511 run; 512 559 LL=100*LL; 560 UL=100*UL; 561 562 /* ask Lois about the following */ 563 564 if UL > 100 then UL = 100; 565 566 run; 567 /* do we need these sorts? I don't think so */ 513 568 proc sort data=rate; 514 569 by %cross1% … … 516 571 ; 517 572 run; 518 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 573 574 proc sort data=Stability; 575 by %cross1% 576 ?cross2? %cross2% 577 ; 578 run; 579 580 581 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 519 582 520 583 ***** Maryland Small Numbers Rule ****************************************; … … 531 594 title2 'TMP: rate with cell suppression'; 532 595 data tmp; 533 set rse; 534 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 535 if (0<SampleN<30) OR (rse >.3) then do; 536 ageadj_percent = .A; 537 lower = .A; 538 upper = .A; 539 popestnum = .A; 540 popestdenom = .A; 541 redflag=put('Not Reportable', $14.); 542 end; 596 set Stability; 597 598 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 599 if &varname in (%spvar2% .); 600 if (0<SampleN < 50) OR (RSE >.3) then do; 601 ageadj_percent = .A; 602 LL = .A; 603 UL = .A; 604 popestnum = .A; 605 popestdenom = .A; 606 redflag=put('Not Reportable', $14.); 607 end; 543 608 proc print data=tmp noobs; title2 'final tmp'; run; 544 609 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateDist8.sas
r21542 r21568 258 258 * CONCATENATE TOTAL ROWS ONTO NEW DOMAIN DATASET ; 259 259 * work.domain is the new domain output, totaltemp is the new one with the ; 260 * cross1 and cross2 output. 260 * cross1 and cross2 output. ; 261 261 ******************************************************************************; 262 262 title2 'TMPALL: stats for domain vars with totals added'; … … 534 534 RSE=(StdErr/wgt_percent); 535 535 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 536 if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); 537 536 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 538 537 539 538 /* RSE=(StdErr/wgt_percent); */ … … 547 546 if &varname. = '.' then delete; 548 547 549 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to '.'and rounding and multiply by 100, deleting cross1 and cross2 totals';548 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 550 549 run; 551 550 … … 598 597 * suppressed_variables code at the end of this file to work. ; 599 598 **************************************************************************; 600 601 599 title2 'TMP: rate with cell suppression'; 602 600 data tmp; 603 601 set Stability; -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateDist8NoVarLevel.sas
r19279 r21568 10 10 * ; 11 11 * Missing set to . for all indicator and dimension vars ; 12 * ; 12 13 * Notes for ibisq survey program. ; 13 14 * ; … … 113 114 weight &weight. ; 114 115 proc print data=stats; title1 '******'; title2 'STATS AGE4CATDIST8 in Domain, and no cross vars'; 115 proc print data=domain; title1 '***** 116 proc print data=domain; title1 '******'; title2 'domain AGE4CATDIST8 in Domain, and no cross vars'; 116 117 run; 117 118 … … 309 310 run; 310 311 proc print data=tmp1 noobs; run; 311 312 312 313 ***** RATE *******************************************************************; 313 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;314 ******************************************************************************; 315 title2 'RATE: ASYMMETRIC CONFIDENCE INTERVALS';314 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 315 ******************************************************************************; 316 title2 'RATE: RATES COMPUTED'; 316 317 data rate; 317 318 set tmp1; 318 319 319 stderr=sqrt(wgt_var); 320 f=log(wgt_percent)-log(1-wgt_percent); 321 s=stderr/(wgt_percent*(1-wgt_percent)); 322 Lf=f-1.96*s; 323 Uf=f+1.96*s; 324 325 lower=exp(Lf)/(1+exp(Lf)); 326 upper=exp(Uf)/(1+exp(Uf)); 320 /********** 321 OLD Asymmetirec? 322 f=log(wgt_percent)-log(1-wgt_percent); 323 s=stderr/(wgt_percent*(1-wgt_percent)); 324 Lf=f-1.96*s; 325 Uf=f+1.96*s; 326 327 lower=exp(Lf)/(1+exp(Lf)); 328 upper=exp(Uf)/(1+exp(Uf)); 329 drop f s Lf Uf wgt_var; 330 *********/ 331 332 333 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 334 /* commenting out, not sure if I need to do theis 335 if (wgt_percent<=0) then do; 336 wgt_percent=0; 337 wgt_percent=0; 338 wgt_var=0; *is this correct, and need to test for it in suppression below; 339 stderr=0; 340 LL=put(0, 7.1); 341 UL=put(0, 7.1); 342 end; 343 */ 344 /* if (0<wgt_percent<1) then do; */ 345 stderr=sqrt(wgt_var); 346 t1=(wgt_percent-(1.96*stderr)); 347 if (t1<0) then t1=0; 348 LL=t1; 349 UL=(wgt_percent+(1.96*stderr)); 350 if UL > 100 then UL = 100; 351 /* end; */ 352 353 if (wgt_percent=1) then do; 354 wgt_percent=0; 355 wgt_var=0; *is this correct, and need to test for it in suppression below; 356 stderr=0; 357 LL=put(0, 7.1); 358 UL=put(0, 7.1); 359 end; 360 361 LL=compress(LL); 362 UL=compress(UL); 363 327 364 if %cross1%=. then delete; 328 365 else if %cross1%='' then delete; … … 341 378 342 379 ***** SAMPLEN ****************************************************************; 343 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;380 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 344 381 ******************************************************************************; 345 382 title2 'SAMPLEN: the n from all the varname totals'; … … 415 452 * redflag is the statistical stability indicator, based on ; 416 453 * the relative standard error (RSE, or coefficient of variation. ; 417 * now using wgt_percent which is mean*weight to calculate RSE;454 * now using wgt_percent which is mean*weight to calculate RSE ; 418 455 **************************************************************************; 419 data rse;456 data Stability; 420 457 set tmp6; 421 458 422 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 423 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 459 redflag=put('Stable', $14.); 460 461 RSE=(StdErr/wgt_percent); 462 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 463 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 464 424 465 425 redflag=put('Stable', $14.); 426 if rse>.3 then redflag=put('Unstable', $14.); 427 if SampleN in (0 1) then redflag=put('No Variance', $14.); 466 /* RSE=(StdErr/wgt_percent); */ 467 468 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 469 if RSE = . then RSE = 0; * is this reasonable?; 470 471 if RSE >.3 then redflag=put('Unstable', $14.); 472 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 473 474 if &varname. = '.' then delete; 475 476 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 477 run; 478 479 data Stability; 480 set Stability; 428 481 if %cross1%=-1 then %cross1%=.; 429 482 else if %cross1%='tot' then %cross1%='.'; … … 437 490 438 491 ageadj_percent=100*wgt_percent; 439 lower=100*lower; 440 upper=100*upper; 441 442 run; 443 492 LL=100*LL; 493 UL=100*UL; 494 495 /* ask Lois about the following */ 496 497 if UL > 100 then UL = 100; 498 499 run; 500 /* do we need these sorts? I don't think so */ 444 501 proc sort data=rate; 445 502 by %cross1% 446 447 503 ; 448 504 run; 449 proc print data=rse noobs; title2 'RSE: RSE computed, no totals'; run; 505 506 proc sort data=Stability; 507 by %cross1% 508 ?cross2? %cross2% 509 ; 510 run; 511 512 513 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 450 514 451 515 ***** Maryland Small Numbers Rule ****************************************; … … 462 526 title2 'TMP: rate with cell suppression'; 463 527 data tmp; 464 set rse; 465 *if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 466 if (0<SampleN<30) OR (rse >.3) then do; 467 ageadj_percent = .A; 468 lower = .A; 469 upper = .A; 470 popestnum = .A; 471 popestdenom = .A; 472 redflag=put('Not Reportable', $14.); 473 end; 528 set Stability; 529 /*Next line NOT USED for NoVarLevel, it is the value for the indicator dimension, (FOCUSLEVEL) passed in by the URL */ 530 /* if &varname in (%spvar2% .); */ 531 if (0<SampleN < 50) OR (RSE >.3) then do; 532 ageadj_percent = .A; 533 LL = .A; 534 UL = .A; 535 popestnum = .A; 536 popestdenom = .A; 537 redflag=put('Not Reportable', $14.); 538 end; 474 539 proc print data=tmp noobs; title2 'final tmp'; run; 475 540 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRate.sas
r21542 r21568 251 251 if .50<=mean<1 then RSE=(StdErr/(1-mean)); 252 252 */ 253 254 /**** test to compare RSE and CV - look at SAS=3 output BUT we are not using now for stability */ 255 256 RSE=(StdErr/mean); 257 258 253 259 redflag=put('Stable', $14.); 254 260 if CV>.3 then redflag=put('Unstable', $14.); -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateMultiYR.sas
r21019 r21568 304 304 ************************************************************************; 305 305 if &varname in (%spvar2% .); 306 if (0<Denom< 30) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/306 if (0<Denom<50) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/ 307 307 wgtN = .A; 308 308 percent = .A; -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateMultiYRMultiSplitPerYear.sas
r21019 r21568 304 304 ************************************************************************; 305 305 if &varname in (%spvar2% .); 306 if (0<Denom< 30) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/306 if (0<Denom<50) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/ 307 307 wgtN = .A; 308 308 percent = .A; -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateMultiYRMultiSplitPerYear20200712.sas
r21019 r21568 304 304 ************************************************************************; 305 305 if &varname in (%spvar2% .); 306 if (0<Denom< 30) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/306 if (0<Denom<50) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/ 307 307 wgtN = .A; 308 308 percent = .A; -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateNoVarLevel.sas
r18175 r21568 257 257 ************************************************************************; 258 258 /* if &varname in (%spvar2% .); */ 259 if (0<Denom< 30) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/260 wgtN = .A;259 if (0<Denom<50) OR (CV >.3) then do; /* MD cell supression Rule Denom (number of folks who answered either y or n)*/ 260 wgtN = .A; 261 261 percent = .A; 262 262 lower = .A; -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE40.sas
r19544 r21568 385 385 run; 386 386 proc print data=tmp1 noobs; run; 387 387 388 388 ***** RATE *******************************************************************; 389 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;389 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 390 390 ******************************************************************************; 391 391 title2 'RATE: RATES COMPUTED'; … … 393 393 set tmp1; 394 394 395 stderr=sqrt(wgt_var); 396 f=log(wgt_percent)-log(1-wgt_percent); 397 s=stderr/(wgt_percent*(1-wgt_percent)); 398 Lf=f-1.96*s; 399 Uf=f+1.96*s; 400 401 lower=exp(Lf)/(1+exp(Lf)); 402 upper=exp(Uf)/(1+exp(Uf)); 395 /********** 396 OLD Asymmetirec? 397 f=log(wgt_percent)-log(1-wgt_percent); 398 s=stderr/(wgt_percent*(1-wgt_percent)); 399 Lf=f-1.96*s; 400 Uf=f+1.96*s; 401 402 lower=exp(Lf)/(1+exp(Lf)); 403 upper=exp(Uf)/(1+exp(Uf)); 404 drop f s Lf Uf wgt_var; 405 *********/ 406 407 408 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 409 /* commenting out, not sure if I need to do theis 410 if (wgt_percent<=0) then do; 411 wgt_percent=0; 412 wgt_percent=0; 413 wgt_var=0; *is this correct, and need to test for it in suppression below; 414 stderr=0; 415 LL=put(0, 7.1); 416 UL=put(0, 7.1); 417 end; 418 */ 419 /* if (0<wgt_percent<1) then do; */ 420 stderr=sqrt(wgt_var); 421 t1=(wgt_percent-(1.96*stderr)); 422 if (t1<0) then t1=0; 423 LL=t1; 424 UL=(wgt_percent+(1.96*stderr)); 425 if UL > 100 then UL = 100; 426 /* end; */ 427 428 if (wgt_percent=1) then do; 429 wgt_percent=0; 430 wgt_var=0; *is this correct, and need to test for it in suppression below; 431 stderr=0; 432 LL=put(0, 7.1); 433 UL=put(0, 7.1); 434 end; 435 436 LL=compress(LL); 437 UL=compress(UL); 438 403 439 if %cross1%=. then delete; 404 440 else if %cross1%='' then delete; 405 441 ?cross2? if %cross2%=. then delete; 406 442 ?cross2? else if %cross2%='' then delete; 407 drop f s Lf Uf wgt_var; 443 408 444 run; 409 445 … … 446 482 ***********Used by MD, they want popestdenom, not samplen********; 447 483 *****************************************************************; 448 proc contents data=tmpall; run; 484 /* proc contents data=tmpall; run; TEST */ 449 485 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 450 486 var Sum; … … 494 530 * redflag is the statistical stability indicator, based on ; 495 531 * the relative standard error (RSE, or coefficient of variation. ; 496 * now using wgt_percent which is mean*weight to calculate RSE;532 * now using wgt_percent which is mean*weight to calculate RSE ; 497 533 **************************************************************************; 498 data rse;534 data Stability; 499 535 set tmp6; 500 536 501 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 502 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 537 redflag=put('Stable', $14.); 538 539 RSE=(StdErr/wgt_percent); 540 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 541 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 503 542 504 redflag=put('Stable', $14.); 505 if rse>.3 then redflag=put('Unstable', $14.); 506 if SampleN in (0 1) then redflag=put('No Variance', $14.); 543 /* RSE=(StdErr/wgt_percent); */ 544 545 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 546 if RSE = . then RSE = 0; * is this reasonable?; 547 548 if RSE >.3 then redflag=put('Unstable', $14.); 549 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 550 551 if &varname. = '.' then delete; 552 553 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 554 run; 555 556 data Stability; 557 set Stability; 507 558 if %cross1%=-1 then %cross1%=.; 508 559 else if %cross1%='tot' then %cross1%='.'; … … 516 567 517 568 ageadj_percent=100*wgt_percent; 518 lower=100*lower; 519 upper=100*upper; 520 521 run; 522 569 LL=100*LL; 570 UL=100*UL; 571 572 /* ask Lois about the following */ 573 574 if UL > 100 then UL = 100; 575 576 run; 577 /* do we need these sorts? I don't think so */ 523 578 proc sort data=rate; 524 579 by %cross1% … … 526 581 ; 527 582 run; 528 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 583 584 proc sort data=Stability; 585 by %cross1% 586 ?cross2? %cross2% 587 ; 588 run; 589 590 591 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 529 592 530 593 ***** Maryland Small Numbers Rule ****************************************; … … 541 604 title2 'TMP: rate with cell suppression'; 542 605 data tmp; 543 set rse; 544 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 545 if (0<SampleN<30) OR (rse >.3) then do; 546 ageadj_percent = .A; 547 lower = .A; 548 upper = .A; 549 popestnum = .A; 550 popestdenom = .A; 551 redflag=put('Not Reportable', $14.); 552 end; 606 set Stability; 607 608 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 609 if &varname in (%spvar2% .); 610 if (0<SampleN < 50) OR (RSE >.3) then do; 611 ageadj_percent = .A; 612 LL = .A; 613 UL = .A; 614 popestnum = .A; 615 popestdenom = .A; 616 redflag=put('Not Reportable', $14.); 617 end; 553 618 proc print data=tmp noobs; title2 'final tmp'; run; 554 619 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE40NoVarLevel.sas
r19542 r21568 318 318 run; 319 319 proc print data=tmp1 noobs; run; 320 320 321 321 ***** RATE *******************************************************************; 322 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;322 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 323 323 ******************************************************************************; 324 324 title2 'RATE: RATES COMPUTED'; … … 326 326 set tmp1; 327 327 328 stderr=sqrt(wgt_var); 329 f=log(wgt_percent)-log(1-wgt_percent); 330 s=stderr/(wgt_percent*(1-wgt_percent)); 331 Lf=f-1.96*s; 332 Uf=f+1.96*s; 333 334 lower=exp(Lf)/(1+exp(Lf)); 335 upper=exp(Uf)/(1+exp(Uf)); 328 /********** 329 OLD Asymmetirec? 330 f=log(wgt_percent)-log(1-wgt_percent); 331 s=stderr/(wgt_percent*(1-wgt_percent)); 332 Lf=f-1.96*s; 333 Uf=f+1.96*s; 334 335 lower=exp(Lf)/(1+exp(Lf)); 336 upper=exp(Uf)/(1+exp(Uf)); 337 drop f s Lf Uf wgt_var; 338 *********/ 339 340 341 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 342 /* commenting out, not sure if I need to do theis 343 if (wgt_percent<=0) then do; 344 wgt_percent=0; 345 wgt_percent=0; 346 wgt_var=0; *is this correct, and need to test for it in suppression below; 347 stderr=0; 348 LL=put(0, 7.1); 349 UL=put(0, 7.1); 350 end; 351 */ 352 /* if (0<wgt_percent<1) then do; */ 353 stderr=sqrt(wgt_var); 354 t1=(wgt_percent-(1.96*stderr)); 355 if (t1<0) then t1=0; 356 LL=t1; 357 UL=(wgt_percent+(1.96*stderr)); 358 if UL > 100 then UL = 100; 359 /* end; */ 360 361 if (wgt_percent=1) then do; 362 wgt_percent=0; 363 wgt_var=0; *is this correct, and need to test for it in suppression below; 364 stderr=0; 365 LL=put(0, 7.1); 366 UL=put(0, 7.1); 367 end; 368 369 LL=compress(LL); 370 UL=compress(UL); 371 336 372 if %cross1%=. then delete; 337 373 else if %cross1%='' then delete; … … 350 386 351 387 ***** SAMPLEN ****************************************************************; 352 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;388 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 353 389 ******************************************************************************; 354 390 title2 'SAMPLEN: the n from all the varname totals'; … … 424 460 * redflag is the statistical stability indicator, based on ; 425 461 * the relative standard error (RSE, or coefficient of variation. ; 426 * now using wgt_percent which is mean*weight to calculate RSE;462 * now using wgt_percent which is mean*weight to calculate RSE ; 427 463 **************************************************************************; 428 data rse;464 data Stability; 429 465 set tmp6; 430 466 431 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 432 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 467 redflag=put('Stable', $14.); 468 469 RSE=(StdErr/wgt_percent); 470 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 471 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 472 433 473 434 redflag=put('Stable', $14.); 435 if rse>.3 then redflag=put('Unstable', $14.); 436 if SampleN in (0 1) then redflag=put('No Variance', $14.); 474 /* RSE=(StdErr/wgt_percent); */ 475 476 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 477 if RSE = . then RSE = 0; * is this reasonable?; 478 479 if RSE >.3 then redflag=put('Unstable', $14.); 480 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 481 482 if &varname. = '.' then delete; 483 484 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to '.' and rounding and multiply by 100, deleting cross1 and cross2 totals'; 485 run; 486 487 data Stability; 488 set Stability; 437 489 if %cross1%=-1 then %cross1%=.; 438 490 else if %cross1%='tot' then %cross1%='.'; … … 446 498 447 499 ageadj_percent=100*wgt_percent; 448 lower=100*lower; 449 upper=100*upper; 450 451 run; 452 500 LL=100*LL; 501 UL=100*UL; 502 503 /* ask Lois about the following */ 504 505 if UL > 100 then UL = 100; 506 507 run; 508 /* do we need these sorts? I don't think so */ 453 509 proc sort data=rate; 454 510 by %cross1% 455 456 511 ; 457 512 run; 458 proc print data=rse noobs; title2 'RSE: RSE computed, no totals'; run; 513 514 proc sort data=Stability; 515 by %cross1% 516 ?cross2? %cross2% 517 ; 518 run; 519 520 521 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 459 522 460 523 ***** Maryland Small Numbers Rule ****************************************; … … 471 534 title2 'TMP: rate with cell suppression'; 472 535 data tmp; 473 set rse; 474 *if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 475 if (0<SampleN<30) OR (rse >.3) then do; 476 ageadj_percent = .A; 477 lower = .A; 478 upper = .A; 479 popestnum = .A; 480 popestdenom = .A; 481 redflag=put('Not Reportable', $14.); 482 end; 536 set Stability; 537 /*Next line NOT USED for NoVarLevel, it is the value for the indicator dimension, (FOCUSLEVEL) passed in by the URL */ 538 /* if &varname in (%spvar2% .); */ 539 if (0<SampleN < 50) OR (RSE >.3) then do; 540 ageadj_percent = .A; 541 LL = .A; 542 UL = .A; 543 popestnum = .A; 544 popestdenom = .A; 545 redflag=put('Not Reportable', $14.); 546 end; 483 547 proc print data=tmp noobs; title2 'final tmp'; run; 484 548 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE50.sas
r19541 r21568 384 384 run; 385 385 proc print data=tmp1 noobs; run; 386 386 387 387 ***** RATE *******************************************************************; 388 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;388 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 389 389 ******************************************************************************; 390 390 title2 'RATE: RATES COMPUTED'; … … 392 392 set tmp1; 393 393 394 stderr=sqrt(wgt_var); 395 f=log(wgt_percent)-log(1-wgt_percent); 396 s=stderr/(wgt_percent*(1-wgt_percent)); 397 Lf=f-1.96*s; 398 Uf=f+1.96*s; 399 400 lower=exp(Lf)/(1+exp(Lf)); 401 upper=exp(Uf)/(1+exp(Uf)); 394 /********** 395 OLD Asymmetirec? 396 f=log(wgt_percent)-log(1-wgt_percent); 397 s=stderr/(wgt_percent*(1-wgt_percent)); 398 Lf=f-1.96*s; 399 Uf=f+1.96*s; 400 401 lower=exp(Lf)/(1+exp(Lf)); 402 upper=exp(Uf)/(1+exp(Uf)); 403 drop f s Lf Uf wgt_var; 404 *********/ 405 406 407 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 408 /* commenting out, not sure if I need to do theis 409 if (wgt_percent<=0) then do; 410 wgt_percent=0; 411 wgt_percent=0; 412 wgt_var=0; *is this correct, and need to test for it in suppression below; 413 stderr=0; 414 LL=put(0, 7.1); 415 UL=put(0, 7.1); 416 end; 417 */ 418 /* if (0<wgt_percent<1) then do; */ 419 stderr=sqrt(wgt_var); 420 t1=(wgt_percent-(1.96*stderr)); 421 if (t1<0) then t1=0; 422 LL=t1; 423 UL=(wgt_percent+(1.96*stderr)); 424 if UL > 100 then UL = 100; 425 /* end; */ 426 427 if (wgt_percent=1) then do; 428 wgt_percent=0; 429 wgt_var=0; *is this correct, and need to test for it in suppression below; 430 stderr=0; 431 LL=put(0, 7.1); 432 UL=put(0, 7.1); 433 end; 434 435 LL=compress(LL); 436 UL=compress(UL); 437 402 438 if %cross1%=. then delete; 403 439 else if %cross1%='' then delete; 404 440 ?cross2? if %cross2%=. then delete; 405 441 ?cross2? else if %cross2%='' then delete; 406 drop f s Lf Uf wgt_var; 442 407 443 run; 408 444 … … 416 452 417 453 ***** SAMPLEN ****************************************************************; 418 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;454 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 419 455 ******************************************************************************; 420 456 title2 'SAMPLEN: the n from all the varname totals'; … … 445 481 ***********Used by MD, they want popestdenom, not samplen********; 446 482 *****************************************************************; 447 proc contents data=tmpall; run; 483 /* proc contents data=tmpall; run; TEST */ 448 484 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 449 485 var Sum; … … 493 529 * redflag is the statistical stability indicator, based on ; 494 530 * the relative standard error (RSE, or coefficient of variation. ; 495 * now using wgt_percent which is mean*weight to calculate RSE;531 * now using wgt_percent which is mean*weight to calculate RSE ; 496 532 **************************************************************************; 497 data rse;533 data Stability; 498 534 set tmp6; 499 535 500 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 501 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 536 redflag=put('Stable', $14.); 537 538 RSE=(StdErr/wgt_percent); 539 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 540 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 502 541 503 redflag=put('Stable', $14.); 504 if rse>.3 then redflag=put('Unstable', $14.); 505 if SampleN in (0 1) then redflag=put('No Variance', $14.); 542 /* RSE=(StdErr/wgt_percent); */ 543 544 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 545 if RSE = . then RSE = 0; * is this reasonable?; 546 547 if RSE >.3 then redflag=put('Unstable', $14.); 548 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 549 550 if &varname. = '.' then delete; 551 552 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 553 run; 554 555 data Stability; 556 set Stability; 506 557 if %cross1%=-1 then %cross1%=.; 507 558 else if %cross1%='tot' then %cross1%='.'; … … 515 566 516 567 ageadj_percent=100*wgt_percent; 517 lower=100*lower; 518 upper=100*upper; 519 520 run; 521 568 LL=100*LL; 569 UL=100*UL; 570 571 /* ask Lois about the following */ 572 573 if UL > 100 then UL = 100; 574 575 run; 576 /* do we need these sorts? I don't think so */ 522 577 proc sort data=rate; 523 578 by %cross1% … … 525 580 ; 526 581 run; 527 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 582 583 proc sort data=Stability; 584 by %cross1% 585 ?cross2? %cross2% 586 ; 587 run; 588 589 590 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 528 591 529 592 ***** Maryland Small Numbers Rule ****************************************; … … 540 603 title2 'TMP: rate with cell suppression'; 541 604 data tmp; 542 set rse; 543 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 544 if (0<SampleN<30) OR (rse >.3) then do; 545 ageadj_percent = .A; 546 lower = .A; 547 upper = .A; 548 popestnum = .A; 549 popestdenom = .A; 550 redflag=put('Not Reportable', $14.); 551 end; 605 set Stability; 606 607 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 608 if &varname in (%spvar2% .); 609 if (0<SampleN < 50) OR (RSE >.3) then do; 610 ageadj_percent = .A; 611 LL = .A; 612 UL = .A; 613 popestnum = .A; 614 popestdenom = .A; 615 redflag=put('Not Reportable', $14.); 616 end; 552 617 proc print data=tmp noobs; title2 'final tmp'; run; 553 618 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE50V1.sas
r19480 r21568 288 288 set work.domain; 289 289 drop DomainLabel VarLabel VarName; 290 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate ;290 %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate Part of ZW hi_iq_func; 291 291 run; 292 292 proc print data=norm ; run; … … 384 384 run; 385 385 proc print data=tmp1 noobs; run; 386 386 387 387 ***** RATE *******************************************************************; 388 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;388 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 389 389 ******************************************************************************; 390 390 title2 'RATE: RATES COMPUTED'; … … 392 392 set tmp1; 393 393 394 stderr=sqrt(wgt_var); 395 f=log(wgt_percent)-log(1-wgt_percent); 396 s=stderr/(wgt_percent*(1-wgt_percent)); 397 Lf=f-1.96*s; 398 Uf=f+1.96*s; 399 400 lower=exp(Lf)/(1+exp(Lf)); 401 upper=exp(Uf)/(1+exp(Uf)); 394 /********** 395 OLD Asymmetirec? 396 f=log(wgt_percent)-log(1-wgt_percent); 397 s=stderr/(wgt_percent*(1-wgt_percent)); 398 Lf=f-1.96*s; 399 Uf=f+1.96*s; 400 401 lower=exp(Lf)/(1+exp(Lf)); 402 upper=exp(Uf)/(1+exp(Uf)); 403 drop f s Lf Uf wgt_var; 404 *********/ 405 406 407 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 408 /* commenting out, not sure if I need to do theis 409 if (wgt_percent<=0) then do; 410 wgt_percent=0; 411 wgt_percent=0; 412 wgt_var=0; *is this correct, and need to test for it in suppression below; 413 stderr=0; 414 LL=put(0, 7.1); 415 UL=put(0, 7.1); 416 end; 417 */ 418 /* if (0<wgt_percent<1) then do; */ 419 stderr=sqrt(wgt_var); 420 t1=(wgt_percent-(1.96*stderr)); 421 if (t1<0) then t1=0; 422 LL=t1; 423 UL=(wgt_percent+(1.96*stderr)); 424 if UL > 100 then UL = 100; 425 /* end; */ 426 427 if (wgt_percent=1) then do; 428 wgt_percent=0; 429 wgt_var=0; *is this correct, and need to test for it in suppression below; 430 stderr=0; 431 LL=put(0, 7.1); 432 UL=put(0, 7.1); 433 end; 434 435 LL=compress(LL); 436 UL=compress(UL); 437 402 438 if %cross1%=. then delete; 403 439 else if %cross1%='' then delete; 404 440 ?cross2? if %cross2%=. then delete; 405 441 ?cross2? else if %cross2%='' then delete; 406 drop f s Lf Uf wgt_var; 442 407 443 run; 408 444 … … 416 452 417 453 ***** SAMPLEN ****************************************************************; 418 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ;454 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below ; 419 455 ******************************************************************************; 420 456 title2 'SAMPLEN: the n from all the varname totals'; … … 445 481 ***********Used by MD, they want popestdenom, not samplen********; 446 482 *****************************************************************; 447 proc contents data=tmpall; run; 483 /* proc contents data=tmpall; run; TEST */ 448 484 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 449 485 var Sum; … … 493 529 * redflag is the statistical stability indicator, based on ; 494 530 * the relative standard error (RSE, or coefficient of variation. ; 495 * now using wgt_percent which is mean*weight to calculate RSE;531 * now using wgt_percent which is mean*weight to calculate RSE ; 496 532 **************************************************************************; 497 data rse;533 data Stability; 498 534 set tmp6; 499 535 500 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 501 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 536 redflag=put('Stable', $14.); 537 538 RSE=(StdErr/wgt_percent); 539 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 540 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 502 541 503 redflag=put('Stable', $14.); 504 if rse>.3 then redflag=put('Unstable', $14.); 505 if SampleN in (0 1) then redflag=put('No Variance', $14.); 542 /* RSE=(StdErr/wgt_percent); */ 543 544 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 545 if RSE = . then RSE = 0; * is this reasonable?; 546 547 if RSE >.3 then redflag=put('Unstable', $14.); 548 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 549 550 if &varname. = '.' then delete; 551 552 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 553 run; 554 555 data Stability; 556 set Stability; 506 557 if %cross1%=-1 then %cross1%=.; 507 558 else if %cross1%='tot' then %cross1%='.'; … … 515 566 516 567 ageadj_percent=100*wgt_percent; 517 lower=100*lower; 518 upper=100*upper; 519 520 run; 521 568 LL=100*LL; 569 UL=100*UL; 570 571 /* ask Lois about the following */ 572 573 if UL > 100 then UL = 100; 574 575 run; 576 /* do we need these sorts? I don't think so */ 522 577 proc sort data=rate; 523 578 by %cross1% … … 525 580 ; 526 581 run; 527 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 582 583 proc sort data=Stability; 584 by %cross1% 585 ?cross2? %cross2% 586 ; 587 run; 588 589 590 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 528 591 529 592 ***** Maryland Small Numbers Rule ****************************************; … … 540 603 title2 'TMP: rate with cell suppression'; 541 604 data tmp; 542 set rse; 543 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 544 if (0<SampleN<30) OR (rse >.3) then do; 545 ageadj_percent = .A; 546 lower = .A; 547 upper = .A; 548 popestnum = .A; 549 popestdenom = .A; 550 redflag=put('Not Reportable', $14.); 551 end; 605 set Stability; 606 607 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 608 if &varname in (%spvar2% .); 609 if (0<SampleN < 50) OR (RSE >.3) then do; 610 ageadj_percent = .A; 611 LL = .A; 612 UL = .A; 613 popestnum = .A; 614 popestdenom = .A; 615 redflag=put('Not Reportable', $14.); 616 end; 552 617 proc print data=tmp noobs; title2 'final tmp'; run; 553 618 -
adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADistMDGE45.sas
r19480 r21568 383 383 384 384 ***** RATE *******************************************************************; 385 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS;385 * CALCULATE CONFIDENCE INTERVALS, NOT ASYMMETRIC ; 386 386 ******************************************************************************; 387 387 title2 'RATE: RATES COMPUTED'; … … 389 389 set tmp1; 390 390 391 stderr=sqrt(wgt_var); 391 /********** 392 OLD Asymmetirec? 392 393 f=log(wgt_percent)-log(1-wgt_percent); 393 394 s=stderr/(wgt_percent*(1-wgt_percent)); … … 397 398 lower=exp(Lf)/(1+exp(Lf)); 398 399 upper=exp(Uf)/(1+exp(Uf)); 400 drop f s Lf Uf wgt_var; 401 *********/ 402 403 404 * if wgt_percent=1 or wgt_percent=0, stderr=0, and CV or RSE=0, need to test for this case in suppression below; 405 /* commenting out, not sure if I need to do theis 406 if (wgt_percent<=0) then do; 407 wgt_percent=0; 408 wgt_percent=0; 409 wgt_var=0; *is this correct, and need to test for it in suppression below; 410 stderr=0; 411 LL=put(0, 7.1); 412 UL=put(0, 7.1); 413 end; 414 */ 415 /* if (0<wgt_percent<1) then do; */ 416 stderr=sqrt(wgt_var); 417 t1=(wgt_percent-(1.96*stderr)); 418 if (t1<0) then t1=0; 419 LL=t1; 420 UL=(wgt_percent+(1.96*stderr)); 421 if UL > 100 then UL = 100; 422 /* end; */ 423 424 if (wgt_percent=1) then do; 425 wgt_percent=0; 426 wgt_var=0; *is this correct, and need to test for it in suppression below; 427 stderr=0; 428 LL=put(0, 7.1); 429 UL=put(0, 7.1); 430 end; 431 432 LL=compress(LL); 433 UL=compress(UL); 434 399 435 if %cross1%=. then delete; 400 436 else if %cross1%='' then delete; 401 437 ?cross2? if %cross2%=. then delete; 402 438 ?cross2? else if %cross2%='' then delete; 403 drop f s Lf Uf wgt_var; 439 404 440 run; 405 441 … … 442 478 ***********Used by MD, they want popestdenom, not samplen********; 443 479 *****************************************************************; 444 proc contents data=tmpall; run; 480 /* proc contents data=tmpall; run; TEST */ 445 481 proc summary data=tmpall nway; /*need to do proc summary across all AA age groups to get weighted counts*/ 446 482 var Sum; … … 490 526 * redflag is the statistical stability indicator, based on ; 491 527 * the relative standard error (RSE, or coefficient of variation. ; 492 * now using wgt_percent which is mean*weight to calculate RSE;528 * now using wgt_percent which is mean*weight to calculate RSE ; 493 529 **************************************************************************; 494 data rse;530 data Stability; 495 531 set tmp6; 496 532 497 if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); 498 if .50<=wgt_percent<1 then RSE=(StdErr/(1-wgt_percent)); 533 redflag=put('Stable', $14.); 534 535 RSE=(StdErr/wgt_percent); 536 /* if 0<wgt_percent<.50 then RSE=(StdErr/wgt_percent); */ 537 /* if .50<=wgt_percent<.95 then RSE=(StdErr/(1-wgt_percent)); REMOVING , NOT USED IN CRUDE */ 499 538 500 redflag=put('Stable', $14.); 501 if rse>.3 then redflag=put('Unstable', $14.); 502 if SampleN in (0 1) then redflag=put('No Variance', $14.); 539 /* RSE=(StdErr/wgt_percent); */ 540 541 if ((wgt_percent = 0) or (wgt_percent = 1)) then RSE=0; /* No Variance */ 542 if RSE = . then RSE = 0; * is this reasonable?; 543 544 if RSE >.3 then redflag=put('Unstable', $14.); 545 if (wgt_percent = 0) OR (wgt_percent = 1) then redflag=put('No Variance', $14.); 546 547 if &varname. = '.' then delete; 548 549 proc print data=Stability noobs; title2 'Stability labels prior to setting totals to . and rounding and multiply by 100, deleting cross1 and cross2 totals'; 550 run; 551 552 data Stability; 553 set Stability; 503 554 if %cross1%=-1 then %cross1%=.; 504 555 else if %cross1%='tot' then %cross1%='.'; … … 512 563 513 564 ageadj_percent=100*wgt_percent; 514 lower=100*lower; 515 upper=100*upper; 516 517 run; 518 565 LL=100*LL; 566 UL=100*UL; 567 568 /* ask Lois about the following */ 569 570 if UL > 100 then UL = 100; 571 572 run; 573 /* do we need these sorts? I don't think so */ 519 574 proc sort data=rate; 520 575 by %cross1% … … 522 577 ; 523 578 run; 524 proc print data=rse noobs; title2 'RSE: RSE computed, totals set to dot'; run; 579 580 proc sort data=Stability; 581 by %cross1% 582 ?cross2? %cross2% 583 ; 584 run; 585 586 587 proc print data=Stability noobs; title2 'Stability: CV/RSE computed, totals set to dot'; run; 525 588 526 589 ***** Maryland Small Numbers Rule ****************************************; … … 537 600 title2 'TMP: rate with cell suppression'; 538 601 data tmp; 539 set rse; 540 if &varname = '%spvar2%'; /*This is the value for the indicator dimension passed in by the URL.;*/ 541 if (0<SampleN<30) OR (rse >.3) then do; 602 set Stability; 603 604 /* if &varname in (%spvar2%); *This is the value for the indicator dimension passed in by the URL.;*/ 605 if &varname in (%spvar2% .); 606 if (0<SampleN < 50) OR (RSE >.3) then do; 542 607 ageadj_percent = .A; 543 lower= .A;544 upper= .A;608 LL = .A; 609 UL = .A; 545 610 popestnum = .A; 546 611 popestdenom = .A; -
adopters/md/trunk/src/main/backend_qModules/brfss23/_BRFSS16.cfg
r21447 r21568 195 195 # 196 196 ### Chronic Disease Multiple Sclerosis 197 #39 MULTIPLESCLEROSIS_MD MultipleSclerosis null DXMS num 0 8198 39 MULTIPLESCLEROSIS_MD MSDiag null DXMS num 0 8197 39 MULTIPLESCLEROSIS_MD MultipleSclerosis null DXMS num 0 8 198 #39 MULTIPLESCLEROSIS_MD MSDiag null DXMS num 0 8 199 199 39 CHCMS_MD MSDiag null MSDiag num 0 8 200 200 39 CHCMSAGE_MD MSDiagAge null MSDiagAge num 0 8
Note: See TracChangeset
for help on using the changeset viewer.