BookmarkSubscribeRSS Feed
gauravkodmalwar
Calcite | Level 5

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

2 REPLIES 2
Kurt_Bremser
Super User

%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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2935 views
  • 0 likes
  • 3 in conversation