BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

In the following proc freq example I create an output data set(out statement) and also print the output.

In the output data set there are only 3 columns: Site,Count,Percent.

In the print output there are 5 columns: Site,Count,Percent,Cumulative count,Cumulative percent.

My question is:

How can I add columns :Cumulative count,Cumulative percent  to the output data set?

How can I add % symbol to the output data set for columns:Percent,,Cumulative percent?

How can I create the output data set without print it?

thanks

Joe

 

data summary_tbl1;
input Site $ 1-8 frq;
datalines;
Atlanta  103
Chicago  486
Dallas   195
Denver   400
New York 307
Seattle  577
;
run;

proc freq data=summary_tbl1;
tables site/out=pelet;
weight frq;
run;

 

 

 

 

 

3 REPLIES 3
SASKiwi
PROC Star

You can find the options for your required outputs in the documentation for the PROC FREQ TABLES statement:

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=procstat&docsetTarget=pro...

 

I suggest you bookmark this web link - documentation.sas.com - for future reference.

Ksharp
Super User
data summary_tbl1;
input Site $ 1-8 frq;
datalines;
Atlanta  103
Chicago  486
Dallas   195
Denver   400
New York 307
Seattle  577
;
run;

proc freq data=summary_tbl1;
tables site/out=pelet outcum outpct;
weight frq;
run;

proc print;run;
PaigeMiller
Diamond | Level 26

@Ronein wrote:

Hello

In the following proc freq example I create an output data set(out statement) and also print the output.

In the output data set there are only 3 columns: Site,Count,Percent.

In the print output there are 5 columns: Site,Count,Percent,Cumulative count,Cumulative percent.

My question is:

How can I add columns :Cumulative count,Cumulative percent  to the output data set?


How about this:

 

ods output onewayfreqs=owf;
proc freq data=summary_tbl1;
tables site/cumcol;
weight frq;
run;

 

How can I add % symbol to the output data set for columns percent, Cumulative percent?

 

This is done via applying formats or picture formats to the values in the output data set OWF.

 

 

--
Paige Miller

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
  • 993 views
  • 0 likes
  • 4 in conversation