BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
RobertWF1
Quartz | Level 8

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;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

@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?

--
Paige Miller
RobertWF1
Quartz | Level 8
The row percents in the crosstab output don't match the table %s in the output dataset.
ballardw
Super User

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
Quartz | Level 8
The OUTPCT option is what I'm looking for, thank you!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 536 views
  • 2 likes
  • 3 in conversation