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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 584 views
  • 0 likes
  • 3 in conversation