BookmarkSubscribeRSS Feed
raja777pharma
Fluorite | Level 6

Hello ,

 

I am try to exceute the sas programs in a dircroty by %inc statement.

 

Requirement : 1) In a dirctory sas program will be genrated based on user input (we don't know number of proagrams                                   and praograsm name )

                       2)  Once user genrated sas programs , then exceute those progrms one by one in sas pogram file.

                       3) once the all prograsm exceuted then exit the current program.

 

Thank you,

Rajasekhar Reddy 

2 REPLIES 2
andreas_lds
Jade | Level 19

Without knowing the names and the order in which the programs have to be executed, your task can't be solved.

Kurt_Bremser
Super User

Don't do this in SAS, use a shell script:

for PROGRAM in ${PROGPATH}/*.sas
do
  sas $PROGRAM
done

Add additional options (autoexec, config, log, output location) to the SAS call.

Running unknown programs in a single SAS instance is dangerous, as one program might change settings (options, libnames, file references, macro variables) and cause unwanted effects in the following codes.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 352 views
  • 0 likes
  • 3 in conversation