SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anucharbe
Fluorite | Level 6

Hi everyone, 

I have the responses from a survey. Some variables have multiple responses (check all that apply) and I was able to code them into binary responses (0/1) into each variable. 

 

I need to calculate the frequency- count and percent of each variable (response) and present the numbers. My problem is that my output is not in the format it needs to be displayed.

 

 OutputFreq.JPG

Here is the SAS code I am using for above output- ( uses only one of the question responses- Q2_0 and its responses)

I need to do this for all the survey questions and their responses. 

 

 proc freq data=survey order= freq;
 table Relation__Mother  Relation__Father Relation__Gaurdian Relation__Other;
 run;

The output needs to look like this- (Expected Output format)

 

ExpectedOutputFormat.JPG

 

I am sure I am missing the simplest of the step in my code, but I really could use help here, in the midst of running codes for 20 different things at the same time. 

I have also attached the data. 

 

Many thanks, 

 

Sincerely,

Anu

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

With dichotomous 0/1 coded variables the Sum is the count of 1's and the Mean is the percent in decimal form.

 

I would be very hesitant in many cases to show a "cumulative" frequency or and especially percent as it may imply something not shown without a LOT of verbiage to describe the contents of the table and interpretation may be somewhat odd. For example think very carefully what is the denominator of that cumulative percent? Now, think again. After that, write it out so we can see what you think it should be.

View solution in original post

3 REPLIES 3
Reeza
Super User
You're showing output that does't match the variable names so it's hard to tell. I think you're going to need to combine your multiple variables to single variables first and then summarize it to get the tables you want.
TomKari
Onyx | Level 15
MR variables are tricky, although they seem to be straightforward.
 
I suggest you set up two datasets; one of respondents with the appropriate variables, and the other of responses, with the appropriate variables. Tabulations on these two datasets should get you what you want.
 
Tom
ballardw
Super User

With dichotomous 0/1 coded variables the Sum is the count of 1's and the Mean is the percent in decimal form.

 

I would be very hesitant in many cases to show a "cumulative" frequency or and especially percent as it may imply something not shown without a LOT of verbiage to describe the contents of the table and interpretation may be somewhat odd. For example think very carefully what is the denominator of that cumulative percent? Now, think again. After that, write it out so we can see what you think it should be.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 3 replies
  • 3509 views
  • 2 likes
  • 4 in conversation