BookmarkSubscribeRSS Feed
Philmsk
Fluorite | Level 6

Hi,

 

I am trying to obtain the adjusted confidence intervals for prevalence rates of a disease standardized by Region, Gender and Age.

I was able to calculate the crude prevalence rates and obtained the weights from the 2016 National Census. 

I am wondering if anybody can help me with the confidence interval calculation for the adjusted prevalence rates.

This is how the sample data looks like with thousands of observations.

 

 

SAS code:sampledat.PNG

 

Sas code;

PROC MEANS DATA=T1 FW=8 MAXDEC=2 CLM MEAN SUM noprint;
CLass REGION GENDER AGECAT;
VAR EVENT;
OUTPUT OUT=Dat_SUM SUM= EVS;
RUN;

DATA CALC1 ;
SET dat_SUM (rename=(_FREQ_=TOTN));
length CIS $19.;
If gender=. then Gender=3; If Agect=. then Agect=9;
/************ Prev rate and conf intervals for crude prevalence rates**********/
If EVS>0 then do; p=EVS/TOTN;
PREV=ROUND(100000*EVS/TOTN,.01);
F = log(p)-log(1-p);
SE = 1/SQRT(p*(1-p)*TOTN);
Lf = F - TINV(1-(0.05/2), TOTN-1)*SE;
Uf = F + TINV(1-(0.05/2), TOTN-1)*SE;
Lp = ROUND((exp(Lf)/(1+exp(Lf)))*100000,.01);
Up = ROUND((exp(Uf)/(1+exp(Uf)))*100000,.01);
CIS='['||STRIP(PUT(Lp,6.2))||', '||STRIP(PUT(Up,6.2))||']';
end;
/**** adjusted rates using the national weights******/
PREV_Ad=ROUND(PREV*weight,.01);
/**** how to calculate the CI's for adjusted rate ???????******/
run;

 

Thanks in Advance.

Phil

2 REPLIES 2
Reeza
Super User

There’s a PROC for that. PROC STDRATE. 


@Philmsk wrote:

Hi,

 

I am trying to obtain the adjusted confidence intervals for prevalence rates of a disease standardized by Region, Gender and Age.

I was able to calculate the crude prevalence rates and obtained the weights from the 2016 National Census. 

I am wondering if anybody can help me with the confidence interval calculation for the adjusted prevalence rates.

This is how the sample data looks like with thousands of observations.

 

 

SAS code:sampledat.PNG

 

Sas code;

PROC MEANS DATA=T1 FW=8 MAXDEC=2 CLM MEAN SUM noprint;
CLass REGION GENDER AGECAT;
VAR EVENT;
OUTPUT OUT=Dat_SUM SUM= EVS;
RUN;

DATA CALC1 ;
SET dat_SUM (rename=(_FREQ_=TOTN));
length CIS $19.;
If gender=. then Gender=3; If Agect=. then Agect=9;
/************ Prev rate and conf intervals for crude prevalence rates**********/
If EVS>0 then do; p=EVS/TOTN;
PREV=ROUND(100000*EVS/TOTN,.01);
F = log(p)-log(1-p);
SE = 1/SQRT(p*(1-p)*TOTN);
Lf = F - TINV(1-(0.05/2), TOTN-1)*SE;
Uf = F + TINV(1-(0.05/2), TOTN-1)*SE;
Lp = ROUND((exp(Lf)/(1+exp(Lf)))*100000,.01);
Up = ROUND((exp(Uf)/(1+exp(Uf)))*100000,.01);
CIS='['||STRIP(PUT(Lp,6.2))||', '||STRIP(PUT(Up,6.2))||']';
end;
/**** adjusted rates using the national weights******/
PREV_Ad=ROUND(PREV*weight,.01);
/**** how to calculate the CI's for adjusted rate ???????******/
run;

 

Thanks in Advance.

Phil


 

StatDave
SAS Super FREQ

If those weights are survey weights, then what you might need is the SURVEYFREQ or SURVEYLOGISTIC procedure.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1612 views
  • 0 likes
  • 3 in conversation