Help using Base SAS procedures

How to run\call one sas file from another file

Reply
Contributor
Posts: 28

How to run\call one sas file from another file

Hi all,

I am new to SAS world and wanted to know, how to run one SAS code file by calling it from another SAS code file. None of them are macro. I know one option is by %INCLUDE but wanted to see some better option where I can also pass on some variable values to called SAS file.

Thanks,

Gaurav

Super User
Posts: 6,946

Re: How to run\call one sas file from another file

%include is the method to use, and values for parametrization can be passed as macro variables. Macro variables are also the method how parameters are fed to stored processes.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,407

Re: How to run\call one sas file from another file

Could you clarify the part about " better option where I can also pass on some variable values to called SAS file ".  The reason I ask is that SAS code files are text files.  Now in the additional step of the macro pre-processesor, all %include statements are replaced by the text found in the respective file.  Therefore it is the full text which is sent to the compiler, there are no "parameters" created/passed.  So please describe a bit more what your attempting to do.

%include is the best method to include other programs, though a cursory mention should be given to reading a file in an infile and then generating code from it.

Ask a Question
Discussion stats
  • 2 replies
  • 339 views
  • 0 likes
  • 3 in conversation