BookmarkSubscribeRSS Feed
archibald
Obsidian | Level 7

Hi all, I have 5 dummy variables coded 1- Yes 0-No

Is there a way proc to tabulate dummy variables just to display the" Yes" categories   and also the total (sum of  both yes and No) for for each variable.

Thank You.

4 REPLIES 4
Reeza
Super User

No. But if it's coded as 0/1 perhaps you can use proc means to get the summary you want? 

 

N = count of obs

Sum = num yes

Mean = percent of yes

 

 

Ksharp
Super User
proc format;
value $fmt(multilabel)
 'F'='F'
 'F','M'='ALL';
run;

proc tabulate data=sashelp.class;
class sex/mlf ;
format sex $fmt.;
table sex*n='';
run;
data_null__
Jade | Level 19
data class;
   set sashelp.class;
   sexdummy = sex eq 'F';
   sexdumm2 = sexdummy;
   run;
proc tabulate;
   var sexdummy sexdumm2;
   tables (sexdummy sexdumm2)*(sum='Count'*f=f8. n='Denom'*f=f8. mean='Percent'*f=percentn.);
   label sexdummy='Gender';
   run;
ballardw
Super User

Provide some example data and what you want the result to look like.

When you say " and also the total (sum of  both yes and No) for for each variable" for a variable coded 1/0 then all of the 0's always sum to 0 so there is likely some additional details that you are leaving out. I suspect you have some nesting levels that you are not specifying clearly.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1873 views
  • 2 likes
  • 5 in conversation