BookmarkSubscribeRSS Feed
SasStatistics
Pyrite | Level 9

I would need to create a custom report that I at the end will export into an excel file. 

One thing I would like to do, is to use the numbers from a Proc freq report to save  into a Macro Variable or into a data step: 

 

proc freq data=MyData;
 table MyVar;
run; 

* The result from this, I would like to save into different macro variables or a data step;

Is this possible to do? Theoretically, I could calculate everything by hand or for instance write it down manually, but obviously I would like to do this automatically. 


 

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26
proc freq data=MyData; 
    table MyVar/out=counts; /* Hint: check the documentation to see if there is an option that does what you want */
run;

or

 

proc freq data=MyData;
    ods output onewayfreqs=counts;
    table MyVar;
run;

 

--
Paige Miller
ballardw
Super User

Better: provide example data, rules and what the report should look like.

When I hear "save into a macro variable" for a report I see lots of extra work that often can be done by either Proc Report or Tabulate.

 

 

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