BookmarkSubscribeRSS Feed
visa
Fluorite | Level 6

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?

5 REPLIES 5
Reeza
Super User

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(). 

 

 

visa
Fluorite | Level 6

@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;

 

 

Reeza
Super User

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.

Reeza
Super User

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. 

PaigeMiller
Diamond | Level 26

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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