I used the SAS Initialization log to get the %eg_whereparam code which looks something like this %macro _eg_WhereParam( COLUMN, PARM, OPERATOR, TYPE=S, MATCHALL=_ALL_VALUES_, MATCHALL_CLAUSE=1, MAX= ,IS_EXPLICIT=0,MATCH_CASE=1);
%local q1 q2 sq1 sq2;
%local isEmpty;
%local isEqual isNotEqual;
%local isIn isNotIn;
%local isString;
%local isBetween;
%let isEqual = ("%QUPCASE(&OPERATOR)" = "EQ" OR "&OPERATOR" = "=");
%let isNotEqual = ("%QUPCASE(&OPERATOR)" = "NE" OR "&OPERATOR" = "<>");
%let isIn = ("%QUPCASE(&OPERATOR)" = "IN");
%let isNotIn = ("%QUPCASE(&OPERATOR)" = "NOT IN");
%let isString = (%QUPCASE(&TYPE) eq S or %QUPCASE(&TYPE) eq STRING );
%if &isString %then
%do;
%if "&MATCH_CASE" eq "0" %then %do;
%let COLUMN = %str(UPPER%(&COLUMN%));
%let q1=%str(UPPER%(%");
%let q2=%str(%"%));
%let sq1=%str(UPPER%(%');
%let sq2=%str(%'%));
%end;
%else %do;
%let q1=%str(%");
%let q2=%str(%");
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%end;
%else %if %QUPCASE(&TYPE) eq D or %QUPCASE(&TYPE) eq DATE %then
%do;
%let q1=%str(%");
%let q2=%str(%"d);
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%else %if %QUPCASE(&TYPE) eq T or %QUPCASE(&TYPE) eq TIME %then
%do;
%let q1=%str(%");
%let q2=%str(%"t);
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%else %if %QUPCASE(&TYPE) eq DT or %QUPCASE(&TYPE) eq DATETIME %then
%do;
%let q1=%str(%");
%let q2=%str(%"dt);
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%else
%do;
%let q1=;
%let q2=;
%let sq1=;
%let sq2=;
%end;
%if "&PARM" = "" %then %let PARM=&COLUMN;
%let isBetween = ("%QUPCASE(&OPERATOR)"="BETWEEN" or "%QUPCASE(&OPERATOR)"="NOT BETWEEN");
The SAS System 09:53 Saturday, June 17, 2017
%if "&MAX" = "" %then %do;
%let MAX = &parm._MAX;
%if &isBetween %then %let PARM = &parm._MIN;
%end;
%if not %symexist(&PARM) or (&isBetween and not %symexist(&MAX)) %then %do;
%if &IS_EXPLICIT=0 %then %do;
not &MATCHALL_CLAUSE
%end;
%else %do;
not 1=1
%end;
%end;
%else %if "%qupcase(&&&PARM)" = "%qupcase(&MATCHALL)" %then %do;
%if &IS_EXPLICIT=0 %then %do;
&MATCHALL_CLAUSE
%end;
%else %do;
1=1
%end;
%end;
%else %if (not %symexist(&PARM._count)) or &isBetween %then %do;
%let isEmpty = ("&&&PARM" = "");
%if (&isEqual AND &isEmpty AND &isString) %then
&COLUMN is null;
%else %if (&isNotEqual AND &isEmpty AND &isString) %then
&COLUMN is not null;
%else %do;
%if &IS_EXPLICIT=0 %then %do;
&COLUMN &OPERATOR %unquote(&q1)&&&PARM%unquote(&q2)
%end;
%else %do;
&COLUMN &OPERATOR %unquote(%nrstr(&sq1))&&&PARM%unquote(%nrstr(&sq2))
%end;
%if &isBetween %then
AND %unquote(&q1)&&&MAX%unquote(&q2);
%end;
%end;
%else
%do;
%local emptyList;
%let emptyList = %symexist(&PARM._count);
%if &emptyList %then %let emptyList = &&&PARM._count = 0;
%if (&emptyList) %then
%do;
%if (&isNotin) %then
1;
%else
0;
%end;
%else %if (&&&PARM._count = 1) %then
%do;
%let isEmpty = ("&&&PARM" = "");
%if (&isIn AND &isEmpty AND &isString) %then
&COLUMN is null;
%else %if (&isNotin AND &isEmpty AND &isString) %then
&COLUMN is not null;
%else %do;
%if &IS_EXPLICIT=0 %then %do;
&COLUMN &OPERATOR (%unquote(&q1)&&&PARM%unquote(&q2))
%end;
%else %do;
&COLUMN &OPERATOR (%unquote(%nrstr(&sq1))&&&PARM%unquote(%nrstr(&sq2)))
%end;
%end;
%end;
%else
%do;
%local addIsNull addIsNotNull addComma; %let addIsNull = %eval(0);
%let addIsNotNull = %eval(0);
%let addComma = %eval(0);
(&COLUMN &OPERATOR (
%do i=1 %to &&&PARM._count;
%let isEmpty = ("&&&PARM&i" = "");
%if (&isString AND &isEmpty AND (&isIn OR &isNotIn)) %then
%do;
%if (&isIn) %then %let addIsNull = 1;
%else %let addIsNotNull = 1;
%end;
%else
%do;
%if &addComma %then %do;,%end; %if &IS_EXPLICIT=0 %then %do;
%unquote(&q1)&&&PARM&i%unquote(&q2)
%end;
%else %do;
%unquote(%nrstr(&sq1))&&&PARM&i%unquote(%nrstr(&sq2))
%end;
%let addComma = %eval(1);
%end;
%end;)
%if &addIsNull %then OR &COLUMN is null;
%else %if &addIsNotNull %then AND &COLUMN is not null;
%do;)
%end;
%end;
%end;
%mend _eg_WhereParam; Then I saved this program(MAC) at the location "Z:\GLM Model\Programs\MAC.sas" Then I used the copy file task to transfer the file from the local PC server to sas workspace server Uploading files from machine "MRK00012" to SAS session on "SASApp".
Using these settings:
Source file specification: Z:\GLM Model\Programs\MAC.sas
Destination path: E:\saswork\_TD26432_SGISASAPP1_\Prc2
Overwrite existing files: Yes
Resolve macro references in file paths: Yes
Convert line endings for text files: No
NOTE: Resolving macro expressions in file paths. SAS log:
1 The SAS System 11:02 Monday, June 19, 2017
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %let _egcopySource = Z:\GLM Model\Programs\MAC.sas;
4 %let _egcopyTarget = E:\saswork\_TD26432_SGISASAPP1_\Prc2;
5 %put Source files resolve to &_egcopySource;
Source files resolve to Z:\GLM Model\Programs\MAC.sas
6 %put Target folder resolves to &_egcopyTarget;
Target folder resolves to E:\saswork\_TD26432_SGISASAPP1_\Prc2
7
8 QUIT; RUN;
9
NOTE: Source file resolved to Z:\GLM Model\Programs\MAC.sas
NOTE: Target folder resolved to E:\saswork\_TD26432_SGISASAPP1_\Prc2
Uploading Z:\GLM Model\Programs\MAC.sas to E:\saswork\_TD26432_SGISASAPP1_\Prc2\MAC.sas ...
...Uploaded MAC.sas, 6,018 bytes
NOTE: Copied 6,018 bytes in 7.19 seconds.
NOTE: Total number of files processed: 1 After that I used the %include macro to call this whereparam macro in my soted process before my Whereparam code %include "E:\saswork\_TD26432_SGISASAPP1_\Prc2\MAC.sas" ;
data VARIABLE_LIST ;
set Actshare.PROMPT ;
format category $100.;
LENGTH CATEGORY $7. ;
if %_eg_WhereParam( name , RF_SEL, IN , TYPE=S, IS_EXPLICIT=0 ) then category = "Factor";
ELSE IF %_eg_WhereParam( name , VT_SEL, IN , TYPE=S, IS_EXPLICIT=0 ) then category = "Variate";
ELSE IF %_eg_WhereParam( name , EXP_SEL, IN , TYPE=S, IS_EXPLICIT=0 ) then category = "Exposure";
ELSE IF %_eg_WhereParam( name , RES_SEL, EQ , TYPE=S, IS_EXPLICIT=0 ) then category = "Response";
else category = "Other";
RUN ; But still it ends up in showing error. 34
35 GOPTIONS ACCESSIBLE;
36 %include "E:\saswork\_TD26432_SGISASAPP1_\Prc2\MAC.sas" ;
201
202 data VARIABLE_LIST ;
203 set Actshare.PROMPT ;
204 format category $100.;
205 LENGTH CATEGORY $7. ;
WARNING: Length of character variable category has already been set.
Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable.
206
207 if %_eg_WhereParam( name , RF_SEL, IN , TYPE=S, IS_EXPLICIT=0 ) then category = "Factor";
NOTE: Line generated by the invoked macro "_EG_WHEREPARAM".
207 The SAS System 09:53 Saturday, June 17, 2017
___
388
76
ERROR 388-185: Expecting an arithmetic operator.
ERROR 76-322: Syntax error, statement will be ignored. I cant understand where is the error in my code.
... View more