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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 268 views
  • 2 likes
  • 3 in conversation