<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IFC Evaluation in SAS/MACRO of a String with Parentheses in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766445#M242905</link>
    <description>&lt;P&gt;I don't understand why you are using two double quote characters?&amp;nbsp; You only need to double up the quote characters when they are part of the value of the string being quoted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I would avoid using IFC(), it does not really add any extra functionality over normal IF/THEN/ELSE coding.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro i(i);
%local range dslist;

%if %sysfunc(quote(&amp;amp;i))="RF" %then %let range=B;
%else %let range=AD;
%let range=&amp;amp;i$A19:&amp;amp;range.0;

%if %sysfunc(quote(&amp;amp;i))="MKT" %then %let dslist=j i; 
%else %let dslist=i;

proc import file=i dbms=xlsx replace out=i;
  range="&amp;amp;range" ;
run;

data i;
  length i $11;
  i=symget('i');
  set i;
  where date&amp;gt;.;
run;

data j;
  set &amp;amp;dslist ;
run;

%mend;

%if %sysfunc(exist(j)) %then %do;
proc delete data=j;
run;
%end ;

options mprint;
%i(MKT)
%i(QMJ Factors)
%i(ME(t-1))
%i(RF)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;PS: You are using the name &lt;STRONG&gt;i&lt;/STRONG&gt; for many different things. The fileref to the downloaded spreadsheet.&amp;nbsp; The parameter to the macro. The dataset name to create.&amp;nbsp; The variable to create in the dataset.&amp;nbsp; It would make the code clearer to using different names for each of those things.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 17:55:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-09-07T17:55:16Z</dc:date>
    <item>
      <title>IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766249#M242830</link>
      <description>&lt;P&gt;The following &lt;CODE&gt;%example&lt;/CODE&gt; is supposed to return &lt;CODE&gt;parenthesis no&lt;/CODE&gt; if there is no parenthesis in the argument and &lt;CODE&gt;parentheses yes&lt;/CODE&gt; otherwise.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro example(argument);

%put %sysfunc(ifc(&amp;amp;argument=string without parenthesis,parenthesis no,parentheses yes));

%mend;

/*this works fine*/
%example(string without parenthesis)

/*this does not work*/
%example(string with (parentheses))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also tried &lt;CODE&gt;%example(%str(string with (parentheses)))&lt;/CODE&gt; for the last one, but it didn't work as well. How should I give the argument of parentheses correctly?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 18:40:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766249#M242830</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2021-09-06T18:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766250#M242831</link>
      <description>&lt;P&gt;It seems adding quotes works as follows.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro example(argument);

%put %sysfunc(ifc("&amp;amp;argument"="string without parenthesis",parenthesis no,parentheses yes));

%mend;

/*this works fine*/
%example(string without parenthesis)

/*this works as well*/
%example(string with (parentheses))&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Sep 2021 18:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766250#M242831</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2021-09-06T18:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766271#M242838</link>
      <description>&lt;P&gt;Yes that's a good workaround.&lt;/P&gt;
&lt;P&gt;Be mindful that your code will fail if the string includes a double quote.&lt;/P&gt;
&lt;P&gt;This is slightly better:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro example(argument);

%put %sysfunc(ifc( %sysfunc(quote(%superq(argument)))="string without parenthesis",parenthesis no,parentheses yes));

%mend;

%example(string without parenthesis)

%example(string %str(%")with (parentheses))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 22:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766271#M242838</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-06T22:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766282#M242844</link>
      <description>&lt;P&gt;Interesting.&amp;nbsp; I would have hoped:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%example(string with %str(%(parentheses%)))
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;would work, but it doesn't:&lt;/P&gt;
&lt;PRE&gt;7    %example(string with %str(%(parentheses%)))
ERROR: Required operator not found in expression: string with (parentheses)=string without parenthesis
ERROR: Argument 1 to function IFC referenced by the %SYSFUNC or %QSYSFUNC macro function is not a
       number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.  Execution of
       %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated.
&lt;/PRE&gt;
&lt;P&gt;Seems like no amount of macro quoting will keep ifc from unquoting it and seeing the parentheses as an instruction to do math.&amp;nbsp; That's unfortunate.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With an old fashioned %IF statement, macro quoting is sufficient:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1    %macro example(argument);
2    %local return ;
3    %if &amp;amp;argument=string without parenthesis %then %let return=parenthesis no ;
4    %else %let return=parentheses yes;
5    %put &amp;amp;return ;
6    %mend;
7
8
9    /*this does not work*/
10   %example(string with (parentheses))
ERROR: Required operator not found in expression: &amp;amp;argument=string without parenthesis
ERROR: The macro EXAMPLE will stop executing.
11
12   /*this does work*/
13   %example(string with %str(%(parentheses%)))
parentheses yes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Sep 2021 00:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766282#M242844</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2021-09-07T00:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766429#M242896</link>
      <description>&lt;P&gt;May I ask one more? Sorry to bother you. The following code downloads an Excel file of multiple sheets and imports the sheets.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename i temp;

proc http url="https://images.aqr.com/-/media/AQR/Documents/Insights/Data-Sets/Quality-Minus-Junk-Factors-Monthly.xlsx" out=i;
run;

%macro i(i);

proc import file=i dbms=xlsx replace out=i;
	range="&amp;amp;i$A19:%sysfunc(ifc(""&amp;amp;i""=""RF"",B,AD))0";
run;

data i;
	i=put("&amp;amp;i",$11.);
	set i;
	where date&amp;gt;.;
run;

data j;
	set %sysfunc(ifc("&amp;amp;i"="MKT",i,j i));
run;

%mend;

proc iml;
	if exist("j") then call delete("j");
quit;

%i(MKT)
%i(QMJ Factors)
%i(ME(t-1))
%i(RF)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The names of the sheets are, for example, &lt;CODE&gt;MKT&lt;/CODE&gt;, &lt;CODE&gt;QMJ Factors&lt;/CODE&gt;, &lt;CODE&gt;ME(t-1)&lt;/CODE&gt;, and &lt;CODE&gt;RF&lt;/CODE&gt;. Because RF has only two columns, I adjusted range for proc import using &lt;CODE&gt;%sysfunc(ifc(""&amp;amp;i""=""RF"",B,AD))&lt;/CODE&gt;—accordingly, I put double quotes &lt;CODE&gt;""&lt;/CODE&gt; inside single quotes &lt;CODE&gt;"&lt;/CODE&gt;. Unfortunately, this adjustment caused an error for &lt;CODE&gt;ME(t-1)&lt;/CODE&gt;. Can't I use the double quotes with the parentheses together?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 16:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766429#M242896</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2021-09-07T16:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766445#M242905</link>
      <description>&lt;P&gt;I don't understand why you are using two double quote characters?&amp;nbsp; You only need to double up the quote characters when they are part of the value of the string being quoted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I would avoid using IFC(), it does not really add any extra functionality over normal IF/THEN/ELSE coding.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro i(i);
%local range dslist;

%if %sysfunc(quote(&amp;amp;i))="RF" %then %let range=B;
%else %let range=AD;
%let range=&amp;amp;i$A19:&amp;amp;range.0;

%if %sysfunc(quote(&amp;amp;i))="MKT" %then %let dslist=j i; 
%else %let dslist=i;

proc import file=i dbms=xlsx replace out=i;
  range="&amp;amp;range" ;
run;

data i;
  length i $11;
  i=symget('i');
  set i;
  where date&amp;gt;.;
run;

data j;
  set &amp;amp;dslist ;
run;

%mend;

%if %sysfunc(exist(j)) %then %do;
proc delete data=j;
run;
%end ;

options mprint;
%i(MKT)
%i(QMJ Factors)
%i(ME(t-1))
%i(RF)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;PS: You are using the name &lt;STRONG&gt;i&lt;/STRONG&gt; for many different things. The fileref to the downloaded spreadsheet.&amp;nbsp; The parameter to the macro. The dataset name to create.&amp;nbsp; The variable to create in the dataset.&amp;nbsp; It would make the code clearer to using different names for each of those things.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 17:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766445#M242905</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-07T17:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766494#M242926</link>
      <description>&lt;P&gt;Like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;I don't see why you add more quotes. The inner quotes are used before any code is compiled and disappear after the macro processor has parsed the text.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notes about your code:&lt;/P&gt;
&lt;P&gt;- Do you have a fetish with letter i ?&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; &amp;nbsp;Use meaningful names to make it more legible&lt;/P&gt;
&lt;P&gt;- i,j,k are normaly used for integers (this goes back FORTRAN requirements). Following norms helps legibility too.&lt;/P&gt;
&lt;P&gt;- You build table J only to delete it as end?&lt;/P&gt;
&lt;P&gt;- Deleting a table is normally done using proc dataset or proc delete&lt;/P&gt;
&lt;P&gt;- Your code could be something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro import(sheet);

proc import file=TMP dbms=xlsx replace out=IMPORTED ;
  range="&amp;amp;sheet$A19:%sysfunc(ifc("&amp;amp;sheet"="RF",B,AD))0";
run;

data TABLEJ;
  length SRC $11;
  set %sysfunc(ifc("&amp;amp;sheet"="MKT", ,TABLEJ )) IMPORTED ;
  where DATE &amp;gt; . ;
  if src=' ' then src="&amp;amp;sheet";
run;

%mend;

proc delete data=IMPORTED; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 22:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766494#M242926</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-07T22:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766496#M242928</link>
      <description>&lt;P&gt;I used the double-double quotes because I wanted double-quoted strings &lt;CODE&gt;"&amp;amp;i"&lt;/CODE&gt; and &lt;CODE&gt;"RF"&lt;/CODE&gt; inside the already double-quoted string passed for &lt;CODE&gt;range&lt;/CODE&gt;.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file=i dbms=xlsx replace out=i;
	range="&amp;amp;i$A19:%sysfunc(ifc(""&amp;amp;i""=""RF"",B,AD))0";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I use &lt;CODE&gt;ifc&lt;/CODE&gt; rather than &lt;CODE&gt;%if&lt;/CODE&gt;/&lt;CODE&gt;%then&lt;/CODE&gt;/&lt;CODE&gt;%else&lt;/CODE&gt; to shorten—of course, the following code would be more explicit and cause no error.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file=i dbms=xlsx replace out=i;
	%if &amp;amp;i=RF %then %do;
		range="&amp;amp;i$A19:B0";
	%end;
	%else %do;
		range="&amp;amp;i$A19:AD0";
	%end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I wondered why the macro string &lt;CODE&gt;ME(t-1)&lt;/CODE&gt; is not resolved properly inside the double-double quotes, unlike inside the single-double quotes &lt;CODE&gt;%sysfunc(ifc("&amp;amp;i"="MKT",i,j i));&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 23:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766496#M242928</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2021-09-07T23:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766502#M242930</link>
      <description>&lt;P&gt;Not too sure why you say the resolution doesn't work for you. It works here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; %let i=1; %put "%sysfunc(ifc(""&amp;amp;i""=""2"" ,a,b))"; %put "%sysfunc(ifc(""&amp;amp;i""=""1"" ,a,b))";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In any case, the double quotes are unneeded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 23:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766502#M242930</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-07T23:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766504#M242931</link>
      <description>&lt;P&gt;I believe the Junyong is suprised that:&lt;/P&gt;
&lt;PRE&gt;%let i=me(T-1);
%put "%sysfunc(ifc(""&amp;amp;i""=""2"" ,a,b))"; 
%put "%sysfunc(ifc(""&amp;amp;i""=""1"" ,a,b))"; &lt;/PRE&gt;
&lt;P&gt;Will error.&lt;/P&gt;
&lt;P&gt;I think adding quote marks here is a bit of a hack, as an attempt to hide ifc from seeing the parentheses as a trigger to do math.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My guess is when you use ""&amp;amp;i"", the double-double-quotes lose their ability to hide the parentheses.&amp;nbsp; Essentially "" loses its meaning as a quote mark to the tokenizer/macro processor.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 00:01:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766504#M242931</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2021-09-08T00:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766505#M242932</link>
      <description>&lt;P&gt;My initial understanding was that passing the five pieces—&lt;CODE&gt;"&amp;amp;sheet$A19:%sysfunc(ifc("&lt;/CODE&gt;, &lt;CODE&gt;&amp;amp;sheet&lt;/CODE&gt;, &lt;CODE&gt;"="&lt;/CODE&gt;, &lt;CODE&gt;RF&lt;/CODE&gt;, and&amp;nbsp;&lt;CODE&gt;",B,AD))0"&lt;/CODE&gt;—for the &lt;CODE&gt;range&lt;/CODE&gt; is impossible as it demands one single- or double-quoted string, but it seems it works with the following &lt;CODE&gt;note 49-169&lt;/CODE&gt;.&lt;/P&gt;&lt;PRE&gt;1    filename tmp temp;
2
3    proc http
3  ! url="https://images.aqr.com/-/media/AQR/Documents/Insights/Data-Sets/Qualit
3  ! y-Minus-Junk-Factors-Monthly.xlsx" out=tmp;
4    run;

NOTE: PROCEDURE HTTP used (Total process time):
      real time           0.95 seconds
      cpu time            0.03 seconds

NOTE: 200 OK

5
6    %macro import(sheet);
7
8    proc import file=TMP dbms=xlsx replace out=IMPORTED ;
9      range="&amp;amp;sheet$A19:%sysfunc(ifc("&amp;amp;sheet"="RF",B,AD))0";
                                             ---
                                             49
NOTE 49-169: The meaning of an identifier after a quoted string might change in
             a future SAS release.  Inserting white space between a quoted
             string and the succeeding identifier is recommended.
10   run;
11
12   data TABLEJ;
13     length SRC $11;
14     set %sysfunc(ifc("&amp;amp;sheet"="MKT", ,TABLEJ )) IMPORTED ;
15     where DATE &amp;gt; . ;
16     if src=' ' then src="&amp;amp;sheet";
17   run;
18
19   %mend;
20
21   proc delete data=IMPORTED; run;

WARNING: File WORK.IMPORTED.DATA does not exist.
NOTE: PROCEDURE DELETE used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


22
23   %import(MKT)

NOTE:    Variable Name Change.  Global Ex USA -&amp;gt; Global_Ex_USA

NOTE:    Variable Name Change.  North America -&amp;gt; North_America

NOTE: The import data set has 1869 observations and 30 variables.
NOTE: WORK.IMPORTED data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.48 seconds
      cpu time            0.47 seconds



NOTE: There were 1141 observations read from the data set WORK.IMPORTED.
      WHERE DATE&amp;gt;.;
NOTE: The data set WORK.TABLEJ has 1141 observations and 31 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


24   %import(QMJ Factors)

NOTE:    Variable Name Change.  Global Ex USA -&amp;gt; Global_Ex_USA

NOTE:    Variable Name Change.  North America -&amp;gt; North_America

NOTE: The import data set has 1869 observations and 30 variables.
NOTE: WORK.IMPORTED data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.48 seconds
      cpu time            0.48 seconds



NOTE: There were 1141 observations read from the data set WORK.TABLEJ.
      WHERE DATE&amp;gt;.;
NOTE: There were 769 observations read from the data set WORK.IMPORTED.
      WHERE DATE&amp;gt;.;
NOTE: The data set WORK.TABLEJ has 1910 observations and 31 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


25   %import(ME(t-1))

NOTE:    Variable Name Change.  Global Ex USA -&amp;gt; Global_Ex_USA

NOTE:    Variable Name Change.  North America -&amp;gt; North_America

NOTE: The import data set has 1969 observations and 30 variables.
NOTE: WORK.IMPORTED data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.31 seconds
      cpu time            0.31 seconds



NOTE: There were 1910 observations read from the data set WORK.TABLEJ.
      WHERE DATE&amp;gt;.;
NOTE: There were 1141 observations read from the data set WORK.IMPORTED.
      WHERE DATE&amp;gt;.;
NOTE: The data set WORK.TABLEJ has 3051 observations and 31 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


26   %import(RF)

NOTE:    Variable Name Change.  Risk Free Rate -&amp;gt; Risk_Free_Rate

NOTE: The import data set has 1830 observations and 2 variables.
NOTE: WORK.IMPORTED data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.39 seconds
      cpu time            0.39 seconds



NOTE: There were 3051 observations read from the data set WORK.TABLEJ.
      WHERE DATE&amp;gt;.;
NOTE: There were 1141 observations read from the data set WORK.IMPORTED.
      WHERE DATE&amp;gt;.;
NOTE: The data set WORK.TABLEJ has 4192 observations and 32 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Sep 2021 00:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766505#M242932</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2021-09-08T00:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: IFC Evaluation in SAS/MACRO of a String with Parentheses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766508#M242933</link>
      <description>&lt;P&gt;So your short-cut is not only making your code harder to read and harder to understand it is also making it harder to get it to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Introducing %SYSFUNC()&amp;nbsp; also opens you up to idiosyncrasies of that tool.&lt;/P&gt;
&lt;P&gt;Plus you are moving the evaluation of the input parameter away from the top of the macro.&lt;/P&gt;
&lt;P&gt;You are creating lines of code that are a mixture of macro code and SAS code. And you have to worry about extra quotes because you are inserting the macro logic into the middle a string variable instead of just setting the strings value and then using it where needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want more brevity try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file=i dbms=xlsx replace out=i;
  range=
%if "&amp;amp;i"="RF" %then "&amp;amp;i$A19:B0";
%else "&amp;amp;i$A19:AD0";
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now the lines of macro logic are more clearly demarked from the lines of SAS code you are using the macro to create.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 02:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IFC-Evaluation-in-SAS-MACRO-of-a-String-with-Parentheses/m-p/766508#M242933</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-08T02:00:46Z</dc:date>
    </item>
  </channel>
</rss>

