BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nasser_DRMCP
Lapis Lazuli | Level 10

Hello,

in a including program; I have got a macro program that need a program name (and folder) as parameter.

In a master program, I have an include of the including program and then I can call the macro by passing &SYSINCLUDEFILEDIR/&SYSINCLUDEFILENAME .

like this %mc_get_prog_info_inc(&SYSINCLUDEFILEDIR/&SYSINCLUDEFILENAME); and It works.I mean the &SYSINCLUDEFILEDIR/&SYSINCLUDEFILENAME contains the correct name of the including program.

But in the including program, if i try to call the macro in another macro like this:

%let test=1;

%macro test;

%if &test=1 %then do ;

%mc_get_prog_info_inc(&SYSINCLUDEFILEDIR/&SYSINCLUDEFILENAME);

%end ;

%mend;

%test ;

it does not work. i mean &SYSINCLUDEFILEDIR and &SYSINCLUDEFILENAME are empty !

thanks in advance for your help

regards

Nasser

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
s_lassen
Meteorite | Level 14

Yes, that's how it is. These two variables are empty inside macros. The easy way out is probably to put the two variables in another macro variable, e.g.:

%let filepath=&SYSINCLUDEFILEDIR/&SYSINCLUDEFILENAME; /* This is in the top of the %include'd program */

Then you can call the macro like this

%mc_get_prog_info_inc(&filepath);

You already got one solution for this, earlier.

View solution in original post

1 REPLY 1
s_lassen
Meteorite | Level 14

Yes, that's how it is. These two variables are empty inside macros. The easy way out is probably to put the two variables in another macro variable, e.g.:

%let filepath=&SYSINCLUDEFILEDIR/&SYSINCLUDEFILENAME; /* This is in the top of the %include'd program */

Then you can call the macro like this

%mc_get_prog_info_inc(&filepath);

You already got one solution for this, earlier.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 657 views
  • 0 likes
  • 2 in conversation