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-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
  • 5 replies
  • 7279 views
  • 4 likes
  • 4 in conversation