The script does not process existing SAS data or create persistent data. It manipulates and displays a literal character string passed as a macro parameter, using only the console (log) for output.
1 Code Block
MACRO DEFINITION & DATA STEP
Explanation : This code block defines and calls the `testit` macro. The macro takes a `path` parameter. Inside the macro, a `DATA _NULL_` step is used to write directly to the SAS log. The `%SYSFUNC(DEQUOTE(&path))` function is crucial here: it removes quotes (single or double) from the value passed to the `path` parameter before it is displayed. The three subsequent calls to `%testit` show how the `DEQUOTE` function handles different string passing syntaxes (without quotes, with single quotes, with double quotes), ensuring that the result displayed in the log is always the path without quotes.
Copied!
%macro testit(path=);
data _null_;
put "%sysfunc(dequote(&path))";
run;
%mend testit;
%testit(path=D:\Projects\);
%testit(path='D:\Projects\');
%testit(path="D:\Projects\");
1
%macro testit(path=);
2
DATA _null_;
3
put "%sysfunc(dequote(&path))";
4
RUN;
5
%mend testit;
6
7
%testit(path=D:\Projects\);
8
%testit(path='D:\Projects\');
9
%testit(path="D:\Projects\");
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.