I'm outputting the frequency counts and %s from a crosstab table to a data set (out=test_freq in example code below).
The conditional percentages by x values are correct in the SAS Results tab, however the %s in the test_freq output dataset are not correct.
Is my syntax incorrect?
data test;
input x $ y $;
cards;
Alice blue
Alice blue
Alice blue
Alice green
Alice green
Alice red
Bob blue
Bob green
Bob green
Bob green
Bob red
Bob red
Bob red
Bob red
;
run;
proc freq data=test;
table x*y / nopercent nocol out=test_freq;
run;
I think you should provide example of what exactly is "not correct" and what you expect the result to be.
By default the OUT= only provides the PERCENT, not the row and column percentages. If you want those using the OUT= option then you need the OUTPCT option to add them the data.
proc freq data=work.test; table x*y / nopercent nocol outpct out=work.test_freq; run;
@RobertWF1 wrote:
The conditional percentages by x values are correct in the SAS Results tab, however the %s in the test_freq output dataset are not correct.
Never say something is incorrect without explanation. We don't know what you expect. What is not correct about the percents?
I think you should provide example of what exactly is "not correct" and what you expect the result to be.
By default the OUT= only provides the PERCENT, not the row and column percentages. If you want those using the OUT= option then you need the OUTPCT option to add them the data.
proc freq data=work.test; table x*y / nopercent nocol outpct out=work.test_freq; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.