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
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.
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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.