Hello,
I would like to know if there is a way to disable (properly) false warning?
On my current project, I have to write dynamically few dos batch with variables thanks to the SET.
But SAS keeps warning me with the "WARNING: Apparent invocation of macro P_ROOT not resolved." because of this :
%let myBat = &path_2_script.\copy.bat;
data _null_;
file "&myBat." encoding="WLATIN1";
length line $1024;
put "echo off";
line = cats("SET P_ROOT=", "&myRoot.");
put line;
run;
data _null_;
set l_folder_2_check;
file "&myBat." mod;
length line $1024;
line = cat("MKDIR ""%P_ROOT%\_", trim(target_env), "_\", trim(current_folder), """ 2>NUL");
put line;
run;
/**
I get here the warning because of the DOS var %P_ROOT%
After the MKDIR, I have a dynamic COPY instructions...
Once the script is done, when I call it with a X command, I get also new warning... (one for each call of %P_ROOT% lol)
**/
I have tried all the options I know, googled also for it without any satisfying solution...
Thx for reading
Michel
Try instead of
"MKDIR ""%P_ROOT%\_"
'MKDIR ""%P_ROOT%\_'
Single quotes should block attempted resolution of macro
Try instead of
"MKDIR ""%P_ROOT%\_"
'MKDIR ""%P_ROOT%\_'
Single quotes should block attempted resolution of macro
As @ballardw noted, single quotes prevent any activity by the macro processor, including trying to locate a macro named %P_ROOT. However, that change needs to be applied in a few areas of your program. Consider this line, for example:
line = cat("MKDIR ""%P_ROOT%\_", trim(target_env), "_\", trim(current_folder), """ 2>NUL");
You would need to change the first parameter to CAT, to use single quotes as the outermost quotes:
line = cat('MKDIR "%P_ROOT%\_', trim(target_env), "_\", trim(current_folder), """ 2>NUL");
If it is just about creating a directory have a look at the DCREATE function.
Works like a charm
Thank all of you 😃
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.