Changeset 20761 in main


Ignore:
Timestamp:
06/09/20 19:13:51 (4 weeks ago)
Author:
Paul Leo
Message:

Put in code to stop divieion by 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • adopters/hi/branches/2.3/src/main/backend_qModules/prams/SurveyCrudeRateNoVarLevel.sas

    r18257 r20761  
    157157data tmp4;
    158158  set tmp2;
    159         f=log(mean)-log(1-mean); 
    160         s=stderr/(mean*(1-mean));
    161         Lf=f-1.96*s; 
    162         Uf=f+1.96*s; 
    163         percent=mean*100;
    164   lower=(exp(Lf)/(1+exp(Lf)))*100;   
    165   upper=(exp(Uf)/(1+exp(Uf)))*100;
     159        if mean >0 then do;
     160                f=log(mean)-log(1-mean); 
     161                s=stderr/(mean*(1-mean));
     162                Lf=f-1.96*s; 
     163                Uf=f+1.96*s; 
     164                percent=mean*100;
     165          lower=(exp(Lf)/(1+exp(Lf)))*100;   
     166          upper=(exp(Uf)/(1+exp(Uf)))*100;
     167  end;
    166168  drop f s Lf Uf VarName;
    167169  proc sort data=tmp4; by %cross1%
     
    260262
    261263  redflag=put('Stable', $14.);
     264
    262265  if rse>.3 then redflag=put('Unstable', $14.);
    263266  if rse>.5 then redflag=put('Very Unstable', $14.);
     
    270273        AND if numerator is less than 50, then set to 50
    271274*/
     275
     276
    272277  If 0<sum<50 then sum=50;
    273278        else if sum >= 50 then sum=ROUND(sum,100);
    274279  If 0<wgtsum<50 then wgtsum=50;
    275280         else if wgtsum >= 50 then wgtsum=ROUND(wgtsum,100);
    276  
     281
    277282  proc sort data=tmp7; by %cross1% &varname.
    278283  ;
     
    287292data tmp;
    288293  set tmp7;
    289  
    290   if (SampleN<30) OR  (rse >.3) then do;        /* Hawaii cell supression Rule */
     294  if (SampleN<30) OR  (rse >.3) then do;        /* Hawaii cell supression Rule  */
    291295        percent = .A;
    292296        lower = .A;
     
    296300        redflag=put('Not Reportable', $14.);
    297301  end;
    298  
     302
    299303  proc print data=tmp; title2 'final tmp: Convert values for cell suppression';
    300304run;
Note: See TracChangeset for help on using the changeset viewer.