Changeset 21568 in main


Ignore:
Timestamp:
09/18/20 12:24:08 (5 weeks ago)
Author:
Paul Leo
Message:

Maryland BRFSS backend .def and .SAS programs
Removed the "use complementary" RSE if percent > 50 for AA. It is not used in Crude.
Reviewed and modified most AA .def and .sas to conform to AAdist8 var names, cell suppression, etc.
Fixed MS var name in BRFSS16.cfg

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  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE2CATDIST18.def

    r19544 r21568  
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE3CATDIST15.def

    r19541 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE3CATDIST15NoVarLevel.def

    r19544 r21568  
    2424  popestnum 15.0
    2525  popestdenom 15.0
    26   lower 7.1
    27   upper 7.1
     26  LL 7.1
     27  UL 7.1
    2828  redflag 14.0
    2929--------BoNdArY--------
     
    3333popestnum
    3434popestdenom
    35 lower
    36 upper
     35LL
     36UL
    3737--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAAAGE3CATDIST16.def

    r19544 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAACRC.def

    r17699 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE40.def

    r17621 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE40NoVarLevel.def

    r17624 r21568  
    2424  popestnum 15.0
    2525  popestdenom 15.0
    26   lower 7.1
    27   upper 7.1
     26  LL 7.1
     27  UL 7.1
    2828  redflag 14.0
    2929--------BoNdArY--------
     
    3333popestnum
    3434popestdenom
    35 lower
    36 upper
     35LL
     36UL
    3737--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE50.def

    r17634 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist10GE50V1.def

    r19480 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8.def

    r19279 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8NoVarLevel.def

    r17583 r21568  
    2424  popestnum 15.0
    2525  popestdenom 15.0
    26   lower 7.1
    27   upper 7.1
     26  LL 7.1
     27  UL 7.1
    2828  redflag 14.0
    2929--------BoNdArY--------
     
    3333popestnum
    3434popestdenom
    35 lower
    36 upper
     35LL
     36UL
    3737--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8NoVarLevelSplitV1.def

    r19795 r21568  
    2626  popestnum 15.0
    2727  popestdenom 15.0
    28   lower 7.1
    29   upper 7.1
     28  LL 7.1
     29  UL 7.1
    3030  redflag 14.0
    3131--------BoNdArY--------
     
    3535popestnum
    3636popestdenom
    37 lower
    38 upper
     37LL
     38UL
    3939--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8NoVarLevelSplitV23.def

    r19807 r21568  
    2626  popestnum 15.0
    2727  popestdenom 15.0
    28   lower 7.1
    29   upper 7.1
     28  LL 7.1
     29  UL 7.1
    3030  redflag 14.0
    3131--------BoNdArY--------
     
    3535popestnum
    3636popestdenom
    37 lower
    38 upper
     37LL
     38UL
    3939--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADist8SplitV1.def

    r21330 r21568  
    1111--------BoNdArY--------
    12121 script
    13 
     13OPTIONS nocenter linesize=MAX;
    1414%include %include%;
    1515 %ageadjrt(%spvar1%,_LNDWTV1);
  • adopters/md/trunk/src/main/backend_qModules/brfss23/RateAADistMDGE45.def

    r19480 r21568  
    99--------BoNdArY--------
    10101 script
    11 
     11OPTIONS nocenter linesize=MAX;
    1212%include %include%;
    1313 %ageadjrt(%spvar1%,_LLCPWT);
     
    2323  popestnum 15.0
    2424  popestdenom 15.0
    25   lower 7.1
    26   upper 7.1
     25  LL 7.1
     26  UL 7.1
    2727  redflag 14.0
    2828--------BoNdArY--------
     
    3232popestnum
    3333popestdenom
    34 lower
    35 upper
     34LL
     35UL
    3636--------BoNdArY--------
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE2CATDIST17.sas

    r19541 r21568  
    280280* age groups that ARE represented in the tmp dataset, and recomputes           ;
    281281* (normalizes) the AA weights so that they sum to 1.0.                         ;
    282 * MD dist10 GE40 compute from NCHS Statnote20 using spreadheet mentioned above ;
     282* MD dist17 compute from NCHS Statnote20 using spreadheet mentioned above ;
    283283*******************************************************************************;
    284284 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)';
     
    286286        set work.domain;
    287287        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;
    289289        run;
    290290        proc print data=norm ; run;
     
    376376   run;   
    377377   proc print data=tmp1 noobs; run;
    378    
     378
    379379***** RATE *******************************************************************;
    380 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     380* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    381381******************************************************************************;
    382382 title2 'RATE: RATES COMPUTED';
     
    384384   set tmp1;
    385385
    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       
    394430        if %cross1%=. then delete;
    395431        else if %cross1%='' then delete;
    396432        ?cross2? if %cross2%=. then delete;
    397433        ?cross2? else if %cross2%='' then delete;
    398     drop f s Lf Uf wgt_var;
     434
    399435 run;
    400436 
     
    408444
    409445***** SAMPLEN ****************************************************************;
    410 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     446* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    411447******************************************************************************;
    412448 title2 'SAMPLEN: the n from all the varname totals';
     
    437473***********Used by MD, they want popestdenom, not samplen********;
    438474*****************************************************************;
    439 proc contents data=tmpall; run;
     475/* proc contents data=tmpall; run;  TEST */
    440476proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    441477  var Sum;
     
    485521* redflag is the statistical stability indicator, based on                ;
    486522* 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            ;
    488524**************************************************************************;
    489 data rse;
     525data Stability;
    490526   set tmp6;
    491527   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    494533 
    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';
     545run;
     546
     547data Stability;
     548        set Stability;
    498549        if %cross1%=-1 then %cross1%=.;
    499550        else if %cross1%='tot' then %cross1%='.';
     
    507558
    508559   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   */
    514569   proc sort data=rate;
    515570   by %cross1%
     
    517572   ;
    518573   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;
    520583
    521584 ***** Maryland Small Numbers Rule ****************************************;
     
    530593 * suppressed_variables code at the end of this file to work.              ;
    531594 **************************************************************************;
    532  title2 'TMP: rate with cell suppression';
     595 
     596 
    533597 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;
    544610   proc print data=tmp noobs;  title2 'final tmp'; run;
    545611
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE2CATDIST18.sas

    r19541 r21568  
    280280* age groups that ARE represented in the tmp dataset, and recomputes           ;
    281281* (normalizes) the AA weights so that they sum to 1.0.                         ;
    282 * MD dist10 GE40 compute from NCHS Statnote20 using spreadheet mentioned above ;
     282* MD dist18 compute from NCHS Statnote20 using spreadheet mentioned above ;
    283283*******************************************************************************;
    284284 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)';
     
    286286        set work.domain;
    287287        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;
    289289        run;
    290290        proc print data=norm ; run;
     
    376376   run;   
    377377   proc print data=tmp1 noobs; run;
    378    
     378
    379379***** RATE *******************************************************************;
    380 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     380* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    381381******************************************************************************;
    382382 title2 'RATE: RATES COMPUTED';
     
    384384   set tmp1;
    385385
    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       
    394430        if %cross1%=. then delete;
    395431        else if %cross1%='' then delete;
    396432        ?cross2? if %cross2%=. then delete;
    397433        ?cross2? else if %cross2%='' then delete;
    398     drop f s Lf Uf wgt_var;
     434
    399435 run;
    400436 
     
    408444
    409445***** SAMPLEN ****************************************************************;
    410 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     446* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    411447******************************************************************************;
    412448 title2 'SAMPLEN: the n from all the varname totals';
     
    437473***********Used by MD, they want popestdenom, not samplen********;
    438474*****************************************************************;
    439 proc contents data=tmpall; run;
     475/* proc contents data=tmpall; run;  TEST */
    440476proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    441477  var Sum;
     
    485521* redflag is the statistical stability indicator, based on                ;
    486522* 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            ;
    488524**************************************************************************;
    489 data rse;
     525data Stability;
    490526   set tmp6;
    491527   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    494533 
    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';
     545run;
     546
     547data Stability;
     548        set Stability;
    498549        if %cross1%=-1 then %cross1%=.;
    499550        else if %cross1%='tot' then %cross1%='.';
     
    507558
    508559   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   */
    514569   proc sort data=rate;
    515570   by %cross1%
     
    517572   ;
    518573   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;
    520583
    521584 ***** Maryland Small Numbers Rule ****************************************;
     
    532595 title2 'TMP: rate with cell suppression';
    533596 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;
    544609   proc print data=tmp noobs;  title2 'final tmp'; run;
    545610
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE3CATDIST15.sas

    r19541 r21568  
    281281* age groups that ARE represented in the tmp dataset, and recomputes           ;
    282282* (normalizes) the AA weights so that they sum to 1.0.                         ;
    283 * MD dist10 GE40 compute from NCHS Statnote20 using spreadheet mentioned above ;
     283* MD dist15 compute from NCHS Statnote20 using spreadheet mentioned above ;
    284284*******************************************************************************;
    285285 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)';
     
    287287        set work.domain;
    288288        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;
    290290        run;
    291291        proc print data=norm ; run;
     
    381381   run;   
    382382   proc print data=tmp1 noobs; run;
    383    
     383
    384384***** RATE *******************************************************************;
    385 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     385* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    386386******************************************************************************;
    387387 title2 'RATE: RATES COMPUTED';
     
    389389   set tmp1;
    390390
    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       
    399435        if %cross1%=. then delete;
    400436        else if %cross1%='' then delete;
    401437        ?cross2? if %cross2%=. then delete;
    402438        ?cross2? else if %cross2%='' then delete;
    403     drop f s Lf Uf wgt_var;
     439
    404440 run;
    405441 
     
    413449
    414450***** SAMPLEN ****************************************************************;
    415 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     451* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    416452******************************************************************************;
    417453 title2 'SAMPLEN: the n from all the varname totals';
     
    442478***********Used by MD, they want popestdenom, not samplen********;
    443479*****************************************************************;
    444 proc contents data=tmpall; run;
     480/* proc contents data=tmpall; run;  TEST */
    445481proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    446482  var Sum;
     
    490526* redflag is the statistical stability indicator, based on                ;
    491527* 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            ;
    493529**************************************************************************;
    494 data rse;
     530data Stability;
    495531   set tmp6;
    496532   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    499538 
    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';
     550run;
     551
     552data Stability;
     553        set Stability;
    503554        if %cross1%=-1 then %cross1%=.;
    504555        else if %cross1%='tot' then %cross1%='.';
     
    512563
    513564   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   */
    519574   proc sort data=rate;
    520575   by %cross1%
     
    522577   ;
    523578   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;
    525588
    526589 ***** Maryland Small Numbers Rule ****************************************;
     
    537600 title2 'TMP: rate with cell suppression';
    538601 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;
    549614   proc print data=tmp noobs;  title2 'final tmp'; run;
    550615
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE3CATDIST15NoVarLevel.sas

    r19544 r21568  
    129129        ;
    130130        set work.domain;
    131         drop DomainLabel VarLabel VarName;
     131        *drop DomainLabel VarLabel VarName;
    132132        %cross1%=-1;
    133133
     
    158158proc print data=stats;  title1 '=================='; title2 'SurveyMeans1 stats'; run;
    159159proc print data=domain; title1 '=================='; title2 'SurveyMeans1 domain'; run;
    160  
     160
    161161/*
    162162*** PROC SURVEYMEANS2 - CELLS ***************************************************;
     
    182182        run;
    183183proc print data=work.domain; title1 '================='; title2 'SURVEYMEANS2: domain from Cells'; run;
    184        
     184
    185185 proc sort data=work.domain;
    186186        by %cross1% AGE3CATDIST15 ;
    187187        run;
    188        
     188
    189189***** TMPALL *****************************************************************;
    190190* CONCATENATE TOTAL ROWS ONTO NEW DOMAIN DATASET                              ;
     
    203203        proc print data=tmpall noobs; run;
    204204
    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***********************************************************************************;
    216216 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)';
    217217 data norm;
    218218        set work.domain;
    219         drop DomainLabel VarLabel VarName;
    220         /* next step invokes one of ZW's */
     219        *drop DomainLabel VarLabel VarName;
     220        /* not quite sure what next step does */
    221221        %ageAdjustedFilter% *dont match the numerator filters to the population filter for accurate variance estimate;
    222222        run;
     
    314314   run;   
    315315   proc print data=tmp1 noobs; run;
    316    
     316
    317317***** RATE *******************************************************************;
    318 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     318* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    319319******************************************************************************;
    320320 title2 'RATE: RATES COMPUTED';
     
    322322   set tmp1;
    323323
    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       
    332368        if %cross1%=. then delete;
    333369        else if %cross1%='' then delete;
     
    346382
    347383***** SAMPLEN ****************************************************************;
    348 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     384* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    349385******************************************************************************;
    350386 title2 'SAMPLEN: the n from all the varname totals';
     
    420456* redflag is the statistical stability indicator, based on                ;
    421457* 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            ;
    423459**************************************************************************;
    424 data rse;
     460data Stability;
    425461   set tmp6;
    426462   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
     468
    429469 
    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';
     481run;
     482
     483data Stability;
     484        set Stability;
    433485        if %cross1%=-1 then %cross1%=.;
    434486        else if %cross1%='tot' then %cross1%='.';
     
    442494
    443495   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   */
    449505   proc sort data=rate;
    450506   by %cross1%
    451 
    452507   ;
    453508   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;
    455518
    456519 ***** Maryland Small Numbers Rule ****************************************;
     
    467530 title2 'TMP: rate with cell suppression';
    468531 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;
    479545   proc print data=tmp noobs;  title2 'final tmp'; run;
    480546
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateAGE3CATDIST16.sas

    r19541 r21568  
    272272        proc print data=tmpall noobs; run;
    273273
    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 GE40 compute 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***********************************************************************************;
    285285 title2 'NORM: grab records in work.domain (summary of records by cross1, cross2 and age group)';
    286286 data norm;
    287287        set work.domain;
    288288        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;
    290290        run;
    291291        proc print data=norm ; run;
     
    381381   run;   
    382382   proc print data=tmp1 noobs; run;
    383    
     383
    384384***** RATE *******************************************************************;
    385 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     385* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    386386******************************************************************************;
    387387 title2 'RATE: RATES COMPUTED';
     
    389389   set tmp1;
    390390
    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       
    399435        if %cross1%=. then delete;
    400436        else if %cross1%='' then delete;
    401437        ?cross2? if %cross2%=. then delete;
    402438        ?cross2? else if %cross2%='' then delete;
    403     drop f s Lf Uf wgt_var;
     439
    404440 run;
    405441 
     
    413449
    414450***** SAMPLEN ****************************************************************;
    415 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     451* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    416452******************************************************************************;
    417453 title2 'SAMPLEN: the n from all the varname totals';
     
    442478***********Used by MD, they want popestdenom, not samplen********;
    443479*****************************************************************;
    444 proc contents data=tmpall; run;
     480/* proc contents data=tmpall; run;  TEST */
    445481proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    446482  var Sum;
     
    490526* redflag is the statistical stability indicator, based on                ;
    491527* 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            ;
    493529**************************************************************************;
    494 data rse;
     530data Stability;
    495531   set tmp6;
    496532   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    499538 
    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';
     550run;
     551
     552data Stability;
     553        set Stability;
    503554        if %cross1%=-1 then %cross1%=.;
    504555        else if %cross1%='tot' then %cross1%='.';
     
    512563
    513564   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   */
    519574   proc sort data=rate;
    520575   by %cross1%
     
    522577   ;
    523578   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;
    525588
    526589 ***** Maryland Small Numbers Rule ****************************************;
     
    537600 title2 'TMP: rate with cell suppression';
    538601 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;
    549614   proc print data=tmp noobs;  title2 'final tmp'; run;
    550615
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateCRC.sas

    r17699 r21568  
    257257* CONCATENATE TOTAL ROWS ONTO NEW DOMAIN DATASET                              ;
    258258* work.domain is the new domain output, totaltemp is the new one with the     ;
    259 * cross1 and cross2 output.                                                    
     259* cross1 and cross2 output.                                                   ;
    260260******************************************************************************;
    261261 title2 'TMPALL: stats for domain vars with totals added';
     
    285285        set work.domain;
    286286        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;
    288288        run;
    289289        proc print data=norm ; run;
     
    375375   run;   
    376376   proc print data=tmp1 noobs; run;
    377    
     377
    378378***** RATE *******************************************************************;
    379 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     379* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    380380******************************************************************************;
    381381 title2 'RATE: RATES COMPUTED';
     
    383383   set tmp1;
    384384
    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       
    393429        if %cross1%=. then delete;
    394430        else if %cross1%='' then delete;
    395431        ?cross2? if %cross2%=. then delete;
    396432        ?cross2? else if %cross2%='' then delete;
    397     drop f s Lf Uf wgt_var;
     433
    398434 run;
    399435 
     
    436472***********Used by MD, they want popestdenom, not samplen********;
    437473*****************************************************************;
    438 proc contents data=tmpall; run;
     474/* proc contents data=tmpall; run;  TEST */
    439475proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    440476  var Sum;
     
    484520* redflag is the statistical stability indicator, based on                ;
    485521* 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            ;
    487523**************************************************************************;
    488 data rse;
     524data Stability;
    489525   set tmp6;
    490526   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    493532 
    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';
     544run;
     545
     546data Stability;
     547        set Stability;
    497548        if %cross1%=-1 then %cross1%=.;
    498549        else if %cross1%='tot' then %cross1%='.';
     
    506557
    507558   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   */
    513568   proc sort data=rate;
    514569   by %cross1%
     
    516571   ;
    517572   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;
    519582
    520583 ***** Maryland Small Numbers Rule ****************************************;
     
    531594 title2 'TMP: rate with cell suppression';
    532595 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;
    543608   proc print data=tmp noobs;  title2 'final tmp'; run;
    544609
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateDist8.sas

    r21542 r21568  
    258258* CONCATENATE TOTAL ROWS ONTO NEW DOMAIN DATASET                              ;
    259259* work.domain is the new domain output, totaltemp is the new one with the     ;
    260 * cross1 and cross2 output.                                                    
     260* cross1 and cross2 output.                                                   ;
    261261******************************************************************************;
    262262 title2 'TMPALL: stats for domain vars with totals added';
     
    534534  RSE=(StdErr/wgt_percent);
    535535  /* 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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    538537 
    539538/*      RSE=(StdErr/wgt_percent); */
     
    547546  if &varname. = '.' then delete;
    548547 
    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';
    550549run;
    551550
     
    598597 * suppressed_variables code at the end of this file to work.              ;
    599598 **************************************************************************;
    600  
    601  
     599 title2 'TMP: rate with cell suppression';
    602600 data tmp;
    603601   set Stability;
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyAARateDist8NoVarLevel.sas

    r19279 r21568  
    1010*                                                                                                      ;
    1111* Missing set to . for all indicator and dimension vars                                                ;
     12*                                                                                                      ;
    1213* Notes for ibisq survey program.                                                                      ;
    1314*                                                                                                      ;
     
    113114                weight &weight. ;
    114115        proc print data=stats; title1 '******'; title2 'STATS AGE4CATDIST8 in Domain, and no cross vars';
    115         proc print data=domain; title1 '***** '; title2 'domain AGE4CATDIST8 in Domain, and no cross vars';
     116        proc print data=domain; title1 '******'; title2 'domain AGE4CATDIST8 in Domain, and no cross vars';
    116117        run;
    117118
     
    309310   run;   
    310311   proc print data=tmp1 noobs; run;
    311    
     312
    312313***** 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';
    316317 data rate;
    317318   set tmp1;
    318319
    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       
    327364        if %cross1%=. then delete;
    328365        else if %cross1%='' then delete;
     
    341378
    342379***** SAMPLEN ****************************************************************;
    343 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     380* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    344381******************************************************************************;
    345382 title2 'SAMPLEN: the n from all the varname totals';
     
    415452* redflag is the statistical stability indicator, based on                ;
    416453* 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            ;
    418455**************************************************************************;
    419 data rse;
     456data Stability;
    420457   set tmp6;
    421458   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
     464
    424465 
    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';
     477run;
     478
     479data Stability;
     480        set Stability;
    428481        if %cross1%=-1 then %cross1%=.;
    429482        else if %cross1%='tot' then %cross1%='.';
     
    437490
    438491   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   */
    444501   proc sort data=rate;
    445502   by %cross1%
    446 
    447503   ;
    448504   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;
    450514
    451515 ***** Maryland Small Numbers Rule ****************************************;
     
    462526 title2 'TMP: rate with cell suppression';
    463527 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;
    474539   proc print data=tmp noobs;  title2 'final tmp'; run;
    475540
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRate.sas

    r21542 r21568  
    251251  if .50<=mean<1 then RSE=(StdErr/(1-mean));
    252252 */
     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 
    253259  redflag=put('Stable', $14.);
    254260  if CV>.3 then redflag=put('Unstable', $14.);
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateMultiYR.sas

    r21019 r21568  
    304304  ************************************************************************;
    305305  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)*/
    307307        wgtN  = .A;
    308308        percent = .A;
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateMultiYRMultiSplitPerYear.sas

    r21019 r21568  
    304304  ************************************************************************;
    305305  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)*/
    307307        wgtN  = .A;
    308308        percent = .A;
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateMultiYRMultiSplitPerYear20200712.sas

    r21019 r21568  
    304304  ************************************************************************;
    305305  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)*/
    307307        wgtN  = .A;
    308308        percent = .A;
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyCrudeRateNoVarLevel.sas

    r18175 r21568  
    257257  ************************************************************************;
    258258  /* 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;
    261261        percent = .A;
    262262        lower = .A;
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE40.sas

    r19544 r21568  
    385385   run;   
    386386   proc print data=tmp1 noobs; run;
    387    
     387
    388388***** RATE *******************************************************************;
    389 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     389* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    390390******************************************************************************;
    391391 title2 'RATE: RATES COMPUTED';
     
    393393   set tmp1;
    394394
    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       
    403439        if %cross1%=. then delete;
    404440        else if %cross1%='' then delete;
    405441        ?cross2? if %cross2%=. then delete;
    406442        ?cross2? else if %cross2%='' then delete;
    407     drop f s Lf Uf wgt_var;
     443
    408444 run;
    409445 
     
    446482***********Used by MD, they want popestdenom, not samplen********;
    447483*****************************************************************;
    448 proc contents data=tmpall; run;
     484/* proc contents data=tmpall; run;  TEST */
    449485proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    450486  var Sum;
     
    494530* redflag is the statistical stability indicator, based on                ;
    495531* 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            ;
    497533**************************************************************************;
    498 data rse;
     534data Stability;
    499535   set tmp6;
    500536   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    503542 
    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';
     554run;
     555
     556data Stability;
     557        set Stability;
    507558        if %cross1%=-1 then %cross1%=.;
    508559        else if %cross1%='tot' then %cross1%='.';
     
    516567
    517568   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   */
    523578   proc sort data=rate;
    524579   by %cross1%
     
    526581   ;
    527582   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;
    529592
    530593 ***** Maryland Small Numbers Rule ****************************************;
     
    541604 title2 'TMP: rate with cell suppression';
    542605 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;
    553618   proc print data=tmp noobs;  title2 'final tmp'; run;
    554619
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE40NoVarLevel.sas

    r19542 r21568  
    318318   run;   
    319319   proc print data=tmp1 noobs; run;
    320    
     320
    321321***** RATE *******************************************************************;
    322 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     322* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    323323******************************************************************************;
    324324 title2 'RATE: RATES COMPUTED';
     
    326326   set tmp1;
    327327
    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       
    336372        if %cross1%=. then delete;
    337373        else if %cross1%='' then delete;
     
    350386
    351387***** SAMPLEN ****************************************************************;
    352 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     388* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    353389******************************************************************************;
    354390 title2 'SAMPLEN: the n from all the varname totals';
     
    424460* redflag is the statistical stability indicator, based on                ;
    425461* 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            ;
    427463**************************************************************************;
    428 data rse;
     464data Stability;
    429465   set tmp6;
    430466   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
     472
    433473 
    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';
     485run;
     486
     487data Stability;
     488        set Stability;
    437489        if %cross1%=-1 then %cross1%=.;
    438490        else if %cross1%='tot' then %cross1%='.';
     
    446498
    447499   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   */
    453509   proc sort data=rate;
    454510   by %cross1%
    455 
    456511   ;
    457512   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;
    459522
    460523 ***** Maryland Small Numbers Rule ****************************************;
     
    471534 title2 'TMP: rate with cell suppression';
    472535 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;
    483547   proc print data=tmp noobs;  title2 'final tmp'; run;
    484548
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE50.sas

    r19541 r21568  
    384384   run;   
    385385   proc print data=tmp1 noobs; run;
    386    
     386
    387387***** RATE *******************************************************************;
    388 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     388* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    389389******************************************************************************;
    390390 title2 'RATE: RATES COMPUTED';
     
    392392   set tmp1;
    393393
    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       
    402438        if %cross1%=. then delete;
    403439        else if %cross1%='' then delete;
    404440        ?cross2? if %cross2%=. then delete;
    405441        ?cross2? else if %cross2%='' then delete;
    406     drop f s Lf Uf wgt_var;
     442
    407443 run;
    408444 
     
    416452
    417453***** SAMPLEN ****************************************************************;
    418 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     454* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    419455******************************************************************************;
    420456 title2 'SAMPLEN: the n from all the varname totals';
     
    445481***********Used by MD, they want popestdenom, not samplen********;
    446482*****************************************************************;
    447 proc contents data=tmpall; run;
     483/* proc contents data=tmpall; run;  TEST */
    448484proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    449485  var Sum;
     
    493529* redflag is the statistical stability indicator, based on                ;
    494530* 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            ;
    496532**************************************************************************;
    497 data rse;
     533data Stability;
    498534   set tmp6;
    499535   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    502541 
    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';
     553run;
     554
     555data Stability;
     556        set Stability;
    506557        if %cross1%=-1 then %cross1%=.;
    507558        else if %cross1%='tot' then %cross1%='.';
     
    515566
    516567   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   */
    522577   proc sort data=rate;
    523578   by %cross1%
     
    525580   ;
    526581   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;
    528591
    529592 ***** Maryland Small Numbers Rule ****************************************;
     
    540603 title2 'TMP: rate with cell suppression';
    541604 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;
    552617   proc print data=tmp noobs;  title2 'final tmp'; run;
    553618
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADist10GE50V1.sas

    r19480 r21568  
    288288        set work.domain;
    289289        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;
    291291        run;
    292292        proc print data=norm ; run;
     
    384384   run;   
    385385   proc print data=tmp1 noobs; run;
    386    
     386
    387387***** RATE *******************************************************************;
    388 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     388* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    389389******************************************************************************;
    390390 title2 'RATE: RATES COMPUTED';
     
    392392   set tmp1;
    393393
    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       
    402438        if %cross1%=. then delete;
    403439        else if %cross1%='' then delete;
    404440        ?cross2? if %cross2%=. then delete;
    405441        ?cross2? else if %cross2%='' then delete;
    406     drop f s Lf Uf wgt_var;
     442
    407443 run;
    408444 
     
    416452
    417453***** SAMPLEN ****************************************************************;
    418 * GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below   ;
     454* GENERATE UNWEIGHTED SAMPLEN FOR CROSS1, CROSS2 for cell suppression below    ;
    419455******************************************************************************;
    420456 title2 'SAMPLEN: the n from all the varname totals';
     
    445481***********Used by MD, they want popestdenom, not samplen********;
    446482*****************************************************************;
    447 proc contents data=tmpall; run;
     483/* proc contents data=tmpall; run;  TEST */
    448484proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    449485  var Sum;
     
    493529* redflag is the statistical stability indicator, based on                ;
    494530* 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            ;
    496532**************************************************************************;
    497 data rse;
     533data Stability;
    498534   set tmp6;
    499535   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    502541 
    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';
     553run;
     554
     555data Stability;
     556        set Stability;
    506557        if %cross1%=-1 then %cross1%=.;
    507558        else if %cross1%='tot' then %cross1%='.';
     
    515566
    516567   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   */
    522577   proc sort data=rate;
    523578   by %cross1%
     
    525580   ;
    526581   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;
    528591
    529592 ***** Maryland Small Numbers Rule ****************************************;
     
    540603 title2 'TMP: rate with cell suppression';
    541604 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;
    552617   proc print data=tmp noobs;  title2 'final tmp'; run;
    553618
  • adopters/md/trunk/src/main/backend_qModules/brfss23/SurveyRateAADistMDGE45.sas

    r19480 r21568  
    383383
    384384***** RATE *******************************************************************;
    385 * CALCULATE ASYMMETRIC CONFIDENCE INTERVALS                                   ;
     385* CALCULATE  CONFIDENCE INTERVALS, NOT ASYMMETRIC                               ;
    386386******************************************************************************;
    387387 title2 'RATE: RATES COMPUTED';
     
    389389   set tmp1;
    390390
    391    stderr=sqrt(wgt_var);
     391/**********
     392        OLD Asymmetirec?
    392393                 f=log(wgt_percent)-log(1-wgt_percent); 
    393394                   s=stderr/(wgt_percent*(1-wgt_percent));
     
    397398                   lower=exp(Lf)/(1+exp(Lf));   
    398399                   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       
    399435        if %cross1%=. then delete;
    400436        else if %cross1%='' then delete;
    401437        ?cross2? if %cross2%=. then delete;
    402438        ?cross2? else if %cross2%='' then delete;
    403     drop f s Lf Uf wgt_var;
     439
    404440 run;
    405441 
     
    442478***********Used by MD, they want popestdenom, not samplen********;
    443479*****************************************************************;
    444 proc contents data=tmpall; run;
     480/* proc contents data=tmpall; run;  TEST */
    445481proc summary data=tmpall nway;  /*need to do proc summary across all AA age groups to get weighted counts*/
    446482  var Sum;
     
    490526* redflag is the statistical stability indicator, based on                ;
    491527* 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            ;
    493529**************************************************************************;
    494 data rse;
     530data Stability;
    495531   set tmp6;
    496532   
    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&lt;=wgt_percent&lt;.95 then RSE=(StdErr/(1-wgt_percent));   REMOVING , NOT USED IN CRUDE  */
    499538 
    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';
     550run;
     551
     552data Stability;
     553        set Stability;
    503554        if %cross1%=-1 then %cross1%=.;
    504555        else if %cross1%='tot' then %cross1%='.';
     
    512563
    513564   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   */
    519574   proc sort data=rate;
    520575   by %cross1%
     
    522577   ;
    523578   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;
    525588
    526589 ***** Maryland Small Numbers Rule ****************************************;
     
    537600 title2 'TMP: rate with cell suppression';
    538601 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;
    542607                 ageadj_percent = .A;
    543      lower = .A;
    544      upper = .A;
     608                 LL = .A;
     609                 UL = .A;
    545610                popestnum = .A;
    546611                popestdenom = .A;
  • adopters/md/trunk/src/main/backend_qModules/brfss23/_BRFSS16.cfg

    r21447 r21568  
    195195#
    196196### Chronic Disease Multiple Sclerosis
    197 #39 MULTIPLESCLEROSIS_MD MultipleSclerosis null DXMS num 0 8
    198 39 MULTIPLESCLEROSIS_MD MSDiag null DXMS num 0 8
     19739 MULTIPLESCLEROSIS_MD MultipleSclerosis null DXMS num 0 8
     198#39 MULTIPLESCLEROSIS_MD MSDiag null DXMS num 0 8
    19919939 CHCMS_MD MSDiag null MSDiag num 0 8
    20020039 CHCMSAGE_MD MSDiagAge null MSDiagAge num 0 8
Note: See TracChangeset for help on using the changeset viewer.