DATA Step, Macro, Functions and more

SAS program to execute multiple SAS programs

Reply
Occasional Contributor
Posts: 7

SAS program to execute multiple SAS programs

Is there a way to execute multiple SAS programs from one program with the use of macro variables in the path and the log?

 

1. I want dynamic dates in the log name

2. The location where the program resides and the log locations are different and both should employ a macro variable.

 

To achieve this, if I use a call command, I am guessing I cannot use dynamic paths or dates. If I use a %include statement, there is a restriction on the number of characters (LRECL should be <=6000).

 

Is there any way to trigger them in data null step or using a macro?

Super User
Posts: 22,818

Re: SAS program to execute multiple SAS programs

If I use a %include statement, there is a restriction on the number of characters (LRECL should be <=6000).

 

You have lines with more than 6000 characters? That seems like a problem in itself. %INCLUDE is always the method I've used.

 

Use PROC PRINTTO in your programs for the log and add the date using %SYSFUNC(). 

 

 

Occasional Contributor
Posts: 7

Re: SAS program to execute multiple SAS programs

[ Edited ]

@Reeza My bad, I thought the restriction was overall. Thank you very much for your suggestions

I used %include but there are two issues I am facing. (I am running using putty)

 

1. I used Printto, but the log file has only "Notes:" but doesn't show the actual lines of the code in log. Is that supposed to be that way? Usually on a log we see both lines of code and the Notes and Warnings.

 

2. If there is a Proc Import step in the sas program that we are calling using %include, the main program doesn't seem to run at all. It runs for a long time, the log file also stands still. Sample proc import that has been used:

 

PROC IMPORT OUT = WORK.ABC

DATAFILE= "&path./ABC.xlsx"

DBMS=XLSX

REPLACE;

 

 

Super User
Posts: 22,818

Re: SAS program to execute multiple SAS programs

Check the documentation for %INCLUDE, I think there's an option you can set to have the code printed in the log as well as the notes and such.

Super User
Posts: 22,818

Re: SAS program to execute multiple SAS programs

And your PROC IMPORT is missing the RUN which is why it's hanging - SAS is waiting for it to terminate and you don't have a termination. 

Respected Advisor
Posts: 2,647

Re: SAS program to execute multiple SAS programs

LRECL is not a restriction on the number of characters.

 

It is a restriction on the number of characters on a single line of code. Are you writing code that has 6000 characters on one line?

 

I think %include will work fine.

--
Paige Miller
Ask a Question
Discussion stats
  • 5 replies
  • 99 views
  • 4 likes
  • 3 in conversation