BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Barkat
Pyrite | Level 9

After data analysis, I have created a table like below. I was asked to calculate weighted proportion, weighted sensitivity, and weighted specificity of each type. I googled a lot but no success. Please help. If not possible in SAS, is there any way to calculate manually, at lease.

Type Count_TotalPop Count_SurveyPop Sensitivity Specificity Proportion_TotalPop Proportion_SurveyPop
A 4000 20 79 67 0.23 0.17
B 3500 30 100 69 0.20 0.26
C 3000 25 90 78 0.17 0.21
D 2000 20 100 100 0.11 0.17
E 5000 22 75 55 0.29 0.19

 

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

I am not sure I understand what you mean when you ask "weight of which variable?"  Typically the weight is part of the sample design.  I would suggest going back to the person who asked for the weighted statistics and ask them what they want you to weight the analysis by.

 

As far as an example you could look at the Getting Started example in the SURVEYFREQ statement.  Note how the data has a variable in it called SamplingWeight which was part of the design.

SAS Help Center: Getting Started: SURVEYFREQ Procedure

 

In your case since you only have weights and not a complex survey design, you would remove the CLUSTER and STRATA statements.

proc surveyfreq data=SIS_Survey;

tables SchoolType * Response / senspec;

weight SamplingWeight;

run;

View solution in original post

5 REPLIES 5
Ksharp
Super User

calling @StatDave

 

data have;
 set sashelp.heart;
 keep status bp_status sex;
run;

proc freq data=have noprint;
table bp_status*status*sex/out=temp list;
run;

proc freq data=temp;
by bp_status;
table status*sex/senspec ;
weight COUNT;
run;
SAS_Rob
SAS Employee

One easy way to do this would be to use Proc SURVEYFREQ with the WEIGHT statement and the SENSPEC option on the TABLES statement.

Barkat
Pyrite | Level 9
I like your idea, but I was wondering, WEIGHT of which variable? Would you please give me an example?
SAS_Rob
SAS Employee

I am not sure I understand what you mean when you ask "weight of which variable?"  Typically the weight is part of the sample design.  I would suggest going back to the person who asked for the weighted statistics and ask them what they want you to weight the analysis by.

 

As far as an example you could look at the Getting Started example in the SURVEYFREQ statement.  Note how the data has a variable in it called SamplingWeight which was part of the design.

SAS Help Center: Getting Started: SURVEYFREQ Procedure

 

In your case since you only have weights and not a complex survey design, you would remove the CLUSTER and STRATA statements.

proc surveyfreq data=SIS_Survey;

tables SchoolType * Response / senspec;

weight SamplingWeight;

run;

ballardw
Super User

Weighted how? What weight is to be applied where?

 


@Barkat wrote:

After data analysis, I have created a table like below. I was asked to calculate weighted proportion, weighted sensitivity, and weighted specificity of each type. I googled a lot but no success. Please help. If not possible in SAS, is there any way to calculate manually, at lease.

Type Count_TotalPop Count_SurveyPop Sensitivity Specificity Proportion_TotalPop Proportion_SurveyPop
A 4000 20 79 67 0.23 0.17
B 3500 30 100 69 0.20 0.26
C 3000 25 90 78 0.17 0.21
D 2000 20 100 100 0.11 0.17
E 5000 22 75 55 0.29 0.19

 


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 5 replies
  • 1053 views
  • 6 likes
  • 4 in conversation