BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cosmid
Lapis Lazuli | Level 10

For example,

 

If I have a program with two macros that print out month report and the other for quarter report:

%macro printmonth(mon);

  print statements here;

%mend printmonth;

 

%macro printqtr(qtr);

  print statements here;

%mend printqtr;

 

%printmonth(Jan);

%printmonth(Feb);

 

%printqtr(qtr1);

 

How do I create two different .lst files and name them as monthly.lst and quarter.lst? Currently, this program will create a single .lst file with the same name as the program.

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

 Something like

 

ods listing file="<path goes her>/filename";
%printmonth(Jan);
%printmonth(Feb);
ods listing close;

ods listing file="<path>/othername";
%printqtr(qtr1);
ods listing close;

 

Though I have a hard time understanding why anyone actually wants Listing output any more.

 


@cosmid wrote:

For example,

 

If I have a program with two macros that print out month report and the other for quarter report:

%macro printmonth(mon);

  print statements here;

%mend printmonth;

 

%macro printqtr(qtr);

  print statements here;

%mend printqtr;

 

%printmonth(Jan);

%printmonth(Feb);

 

%printqtr(qtr1);

 

How do I create two different .lst files and name them as monthly.lst and quarter.lst? Currently, this program will create a single .lst file with the same name as the program.

 

Thanks!

 

 


 

View solution in original post

6 REPLIES 6
ballardw
Super User

 Something like

 

ods listing file="<path goes her>/filename";
%printmonth(Jan);
%printmonth(Feb);
ods listing close;

ods listing file="<path>/othername";
%printqtr(qtr1);
ods listing close;

 

Though I have a hard time understanding why anyone actually wants Listing output any more.

 


@cosmid wrote:

For example,

 

If I have a program with two macros that print out month report and the other for quarter report:

%macro printmonth(mon);

  print statements here;

%mend printmonth;

 

%macro printqtr(qtr);

  print statements here;

%mend printqtr;

 

%printmonth(Jan);

%printmonth(Feb);

 

%printqtr(qtr1);

 

How do I create two different .lst files and name them as monthly.lst and quarter.lst? Currently, this program will create a single .lst file with the same name as the program.

 

Thanks!

 

 


 

cosmid
Lapis Lazuli | Level 10

I didn't know any other output file format from SAS that might work in UNIX so I picked .lst. The method worked! Thank you so much for your help!

ballardw
Super User

ODS PDF should work and would allow way more appearance controls. I expect you can create ODS RTF files though I don't know if you would have a program to display them.

 


@cosmid wrote:

I didn't know any other output file format from SAS that might work in UNIX so I picked .lst. The method worked! Thank you so much for your help!


 

cosmid
Lapis Lazuli | Level 10
I have never tried either of them in UNIX environment. Once I have a chance I will give both a try and update you. Thanks again for showing me how to use the ods file statement. I learned about it before but didn't know I can use it straight up on a macro.
Tom
Super User Tom
Super User

@cosmid wrote:
I have never tried either of them in UNIX environment. Once I have a chance I will give both a try and update you. Thanks again for showing me how to use the ods file statement. I learned about it before but didn't know I can use it straight up on a macro.

The macro processor is just a tool to allow you to generate SAS code.  So you can use it to generate any valid SAS code that you want to generate.

cosmid
Lapis Lazuli | Level 10

I have tried with RTF and PDF in the UNIX environment and it didn't work. It creates a file ending in .rtf and .pdf but once opened, they are just gibberish. Maybe I need to contact system admin for add-ons to open RTF or PDF files in UNIX? However, they both worked in SAS Windows. For me, the lst is sufficent and gets the job done.

 

Thanks again, now I learned how to create RTF and PDF in SAS Windows. I'm sure this will come in handy when I need it.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 2034 views
  • 7 likes
  • 3 in conversation