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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.