SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
abhityagi
Obsidian | Level 7

Hi Team,

 

How to store in output table or dataset for given below proc freq results.

 

proc freq data=source1;
run;

 

Note: I want to store proc freq results for all the columns which are in source1 dataset.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

This example shows you how to get a nice clean table. Just change replace your proc freq with mine and you should get the output wanted. 

 

https://gist.github.com/statgeek/e0903d269d4a71316a4e

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

You can use the OUT= option of the TABLES statement.

 

If you really don't want to use the TABLES statement, then you can use

 

ODS OUTPUT ONEWAYFREQS=FREQS;

--
Paige Miller
abhityagi
Obsidian | Level 7

Thanks for your reply.

 

However, given below statement does not work. I want to keep freq results for all the columns in output dataset.

 

proc freq data=source1;

tables _all_ / out=freq_results;

run

Reeza
Super User

This example shows you how to get a nice clean table. Just change replace your proc freq with mine and you should get the output wanted. 

 

https://gist.github.com/statgeek/e0903d269d4a71316a4e

abhityagi
Obsidian | Level 7

Thanks Reeza.

Tom
Super User Tom
Super User

What type of output do you want?  If you want a single dataset that has checker board pattern of missing values you can either use the ODS output data or use PROC SUMMARY.

Run this to see what the results look like so a small test dataset.

data test;
  set sashelp.class (obs=5);
  keep name age height ;
run;
proc print data=test;
run;

ods exclude ONEWAYFREQS;
ods output ONEWAYFREQS=want1;
proc freq data=test;
run;
ods exclude none;

proc print data=want1; run;

proc summary data=test chartype ;
 class _all_;
 ways 1;
 output out=want2;
run;

proc print data=want2;
run;

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 10142 views
  • 4 likes
  • 4 in conversation