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 | |||||||||
C | Male | Positive | |||||||
Negative | |||||||||
Female | Positive | ||||||||
Negative |
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?
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;
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: