BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
_maldini_
Barite | Level 11

I'm trying to output summary statistics from PROC FREQ so that I can use PROC SGPLOT to plot column percentage on an X-axis.

 

I'm trying to following the SAS documentation: "If you specify the OUTPCT option for a two-way or multiway table, the output data set also includes row, column, and table percentages."

 

PROC FREQ DATA=subset;
	TABLES make*origin / OUT=OUTPCT;
RUN; 

The above syntax only produces a data set w/ Count and Total Percent. 

 

What is the proper format for the OUT= option?
How do I incorporate OUTEXPECT or OUTPCT or PCT_COL into the syntax?

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You did not include the OUTPCT option on the TABLES statement.  You used OUTPCT as the NAME of the dataset that the OUT= option is creating.

PROC FREQ DATA=sashelp.cars;
	TABLES make*origin / OUT=want OUTPCT noprint;
RUN; 

proc print data=want(obs=4);
run;
Obs    Make     Origin    COUNT    PERCENT    PCT_ROW    PCT_COL

  1    Acura    Asia         7     1.63551      100       4.4304
  2    Audi     Europe      19     4.43925      100      15.4472
  3    BMW      Europe      20     4.67290      100      16.2602
  4    Buick    USA          9     2.10280      100       6.1224


View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

You did not include the OUTPCT option on the TABLES statement.  You used OUTPCT as the NAME of the dataset that the OUT= option is creating.

PROC FREQ DATA=sashelp.cars;
	TABLES make*origin / OUT=want OUTPCT noprint;
RUN; 

proc print data=want(obs=4);
run;
Obs    Make     Origin    COUNT    PERCENT    PCT_ROW    PCT_COL

  1    Acura    Asia         7     1.63551      100       4.4304
  2    Audi     Europe      19     4.43925      100      15.4472
  3    BMW      Europe      20     4.67290      100      16.2602
  4    Buick    USA          9     2.10280      100       6.1224


AMSAS
SAS Super FREQ
PROC FREQ DATA=sashelp.class;
	TABLES sex*age / OUTPCT out=OUTPCT;
RUN; 

You mean like that?

ballardw
Super User

OUT= names the data set created with the name following the =. OUTPCT as an option would look like:

 

PROC FREQ DATA=subset;
	TABLES make*origin / OUT= mydatasetname OUTPCT;
RUN; 

 

 

 


@_maldini_ wrote:

I'm trying to output summary statistics from PROC FREQ so that I can use PROC SGPLOT to plot column percentage on an X-axis.

 

I'm trying to following the SAS documentation: "If you specify the OUTPCT option for a two-way or multiway table, the output data set also includes row, column, and table percentages."

 

PROC FREQ DATA=subset;
	TABLES make*origin / OUT=OUTPCT;
RUN; 

The above syntax only produces a data set w/ Count and Total Percent. 

 

What is the proper format for the OUT= option?
How do I incorporate OUTEXPECT or OUTPCT or PCT_COL into the syntax?

 

Thanks!

 


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1235 views
  • 3 likes
  • 4 in conversation