BookmarkSubscribeRSS Feed
Barkat
Pyrite | Level 9

I have a survey data. I need to create a table as below. I tried the following code, but it's not providing the expected table. Please help,

Please note, I have a variable called "Wt" as well for calculating weighted results.

 

 

 

Proc surveyfreq data= have;

table country*gender*result /cl ;

Weight Wt;

run;

 

 

Country Gender Result Frequency Weighted Freq. Std. Err of Wgt Freq Percent Std Err of Percent 95% confidence limit for percent
A Male Positive              
    Negative              
  Female Positive              
    Negative              
B Male Positive              
    Negative              
  Female Positive              
    Negative              
Male Positive              
    Negative              
  Female Positive              
    Negative              
2 REPLIES 2
ballardw
Super User

Without data and at least some description of what is need it is very hard to provide any concrete suggestions.

 

Since you are not providing any sample design information, sampling method, strata, cluster and such one question is why are you using Surveyfreq?

Barkat
Pyrite | Level 9

This is an example data. I am using Surveyfreq to get confidence limit.

data have;
input ID Country $ Gender $ Result $;
datalines;
1 A Male Positive
2 B Male Negative
3 C Female Negative
4 A Female Negative
5 B Male Positive
6 C Male Positive
7 A Female Positive
8 B Female Negative
9 B Male Positive
;

Data have; set have;
if Country="A" then Prob=0.0617;
if Country="B" then Prob=0.0300;
if Country="C" then Prob=0.0780;
Wt=1/Prob;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1080 views
  • 2 likes
  • 2 in conversation