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.
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
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 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;
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.