BookmarkSubscribeRSS Feed
Nitish1003
Obsidian | Level 7

Hi All,

 

I am trying to create a run book to have all my code in one place with %include statement.

I have a job code and code name. What I did is I created a dataset with Job_Code, code_name and added Sn_no. Now I am trying to create a macro so that I can pass the Sn_no and that particular code should get executed. 

Any suggestion on how should I proceed with this? Thanks a lot for looking into it 

2 REPLIES 2
Reeza
Super User
%macro run_snno(sn_no=);

data _null_;
set jobs;
where sn_no = &sn_no.;
rc = dosubl(catt("%include('", code_name, "');"));
run;


%mend;

One possibility. 

 

If you want to pass multiple SN_NO this could be expanded to use IN instead easily.

 


@Nitish1003 wrote:

Hi All,

 

I am trying to create a run book to have all my code in one place with %include statement.

I have a job code and code name. What I did is I created a dataset with Job_Code, code_name and added Sn_no. Now I am trying to create a macro so that I can pass the Sn_no and that particular code should get executed. 

Any suggestion on how should I proceed with this? Thanks a lot for looking into it 


 

Nitish1003
Obsidian | Level 7

Thanks a lot this helped

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!

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
  • 244 views
  • 0 likes
  • 2 in conversation