<?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: Proc export with if condition in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573588#M34215</link>
    <description>&lt;P&gt;You cannot use SAS functions inline just like that, you need to wrap them in %SYSFUNC().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if (day(now) between 8 and 14) and workday(now)=2 %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What is now?????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you meant something like today or the date() function something like this should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if  %sysfunc(today(), day.) &amp;gt;=8 and %sysfunc(today(), day.) &amp;lt;=14 %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259239"&gt;@FRAFLUTE&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good Morning&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with a proc sql&amp;nbsp;I produce the db out_invoices that i want to export only if it is the second monday of the month (a monday in a day between&amp;nbsp;8 and 14&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the macro that i've created:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro export_conditionally;
%if (day(now) between 8 and 14) and workday(now)=2 %then %do;
proc export 
  data=work.out_invoices
  dbms=xlsx 
  outfile="\\23- REPORT\CUSTOMER.xlsx" 
  replace;
run;
%end&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;%export_conditionally;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i open SAS, in the first time, the program execute correctly the code. From the second run the macro crash and give this error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_________________________________&lt;/P&gt;
&lt;P&gt;49&lt;/P&gt;
&lt;P&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;/P&gt;
&lt;P&gt;between a quoted string and the succeeding identifier is recommended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i'm doing wrong? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jul 2019 16:35:01 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-07-15T16:35:01Z</dc:date>
    <item>
      <title>Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573579#M34213</link>
      <description>&lt;P&gt;Good Morning&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with a proc sql&amp;nbsp;I produce the db out_invoices that i want to export only if it is the second monday of the month (a monday in a day between&amp;nbsp;8 and 14&amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the macro that i've created:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro export_conditionally;
%if (day(now) between 8 and 14) and workday(now)=2 %then %do;
proc export 
  data=work.out_invoices
  dbms=xlsx 
  outfile="\\23- REPORT\CUSTOMER.xlsx" 
  replace;
run;
%end&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;%export_conditionally;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i open SAS, in the first time, the program execute correctly the code. From the second run the macro crash and give this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_________________________________&lt;/P&gt;&lt;P&gt;49&lt;/P&gt;&lt;P&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;/P&gt;&lt;P&gt;between a quoted string and the succeeding identifier is recommended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i'm doing wrong? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 16:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573579#M34213</guid>
      <dc:creator>FRAFLUTE</dc:creator>
      <dc:date>2019-07-15T16:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573584#M34214</link>
      <description>&lt;P&gt;Can you provide the full log pertaining to the code that is running and producing the error as well as the details around it?&lt;BR /&gt;&lt;BR /&gt;Additionally... Can you provide the coding logic around where you actually call this macro?&lt;BR /&gt;&lt;BR /&gt;These details would give us a better idea of what may be happening and causing the error that you see.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 16:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573584#M34214</guid>
      <dc:creator>tsap</dc:creator>
      <dc:date>2019-07-15T16:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573588#M34215</link>
      <description>&lt;P&gt;You cannot use SAS functions inline just like that, you need to wrap them in %SYSFUNC().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if (day(now) between 8 and 14) and workday(now)=2 %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What is now?????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you meant something like today or the date() function something like this should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if  %sysfunc(today(), day.) &amp;gt;=8 and %sysfunc(today(), day.) &amp;lt;=14 %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259239"&gt;@FRAFLUTE&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good Morning&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with a proc sql&amp;nbsp;I produce the db out_invoices that i want to export only if it is the second monday of the month (a monday in a day between&amp;nbsp;8 and 14&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the macro that i've created:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro export_conditionally;
%if (day(now) between 8 and 14) and workday(now)=2 %then %do;
proc export 
  data=work.out_invoices
  dbms=xlsx 
  outfile="\\23- REPORT\CUSTOMER.xlsx" 
  replace;
run;
%end&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;%export_conditionally;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i open SAS, in the first time, the program execute correctly the code. From the second run the macro crash and give this error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_________________________________&lt;/P&gt;
&lt;P&gt;49&lt;/P&gt;
&lt;P&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;/P&gt;
&lt;P&gt;between a quoted string and the succeeding identifier is recommended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i'm doing wrong? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 16:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573588#M34215</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-15T16:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573589#M34216</link>
      <description>&lt;P&gt;What exactly are you trying to test in your %IF statement?&lt;/P&gt;
&lt;P&gt;Right now you seem be doing a test in form of A and B.&amp;nbsp; Where B is the number 14 which SAS will evaluate as TRUE and A is the string&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;day(now) between 8 &lt;/PRE&gt;
&lt;P&gt;which should cause SAS to generate an error since that is not a valid number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to see if today is a monday?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;2=%sysfunc(weekday(%sysfunc(today())))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also you want to see if today's day of the month is between 8 and 14?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;8&amp;lt;=%sysfunc(day(%sysfunc(today())))
and %sysfunc(day(%sysfunc(today())))&amp;lt;=14&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, 15 Jul 2019 16:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573589#M34216</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-15T16:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573594#M34217</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259239"&gt;@FRAFLUTE&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good Morning&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with a proc sql&amp;nbsp;I produce the db out_invoices that i want to export only if it is the second monday of the month (a monday in a day between&amp;nbsp;8 and 14&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the macro that i've created:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro export_conditionally;
%if (day(now) between 8 and 14) and workday(now)=2 %then %do;
proc export 
  data=work.out_invoices
  dbms=xlsx 
  outfile="\\23- REPORT\CUSTOMER.xlsx" 
  replace;
run;
%end&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;%export_conditionally;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i open SAS, in the first time, the program execute correctly the code. From the second run the macro crash and give this error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_________________________________&lt;/P&gt;
&lt;P&gt;49&lt;/P&gt;
&lt;P&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;/P&gt;
&lt;P&gt;between a quoted string and the succeeding identifier is recommended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i'm doing wrong? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If &lt;STRONG&gt;what&lt;/STRONG&gt; is the second Monday? The date the program runs? The date of the invoices?&lt;/P&gt;
&lt;P&gt;Your shown definition of a the macro is missing a semicolon between the %end and %mend so that might be an issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show the entire procedure, data step or macro that generates the warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If&amp;nbsp;using a macro make sure the option MPRINT is on. Post the log into a code box opened with the forum's {I} or "running man" icon to preserve the formatting of the error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that is NOT and error is just says that somewhere, in code you have not shown you likely have some value in quote followed by a letter without a space such as "something"q. Since SAS uses several quoted strings followed by a letter to denote special literal values: date "01JAN2019"d , time "13:30:25"t , datetime "01JAN2019:13:30:25"dt, name literals for variables "Not normal varname"n and such, SAS is warning you that such code might cause an error in the future because the particular quote+character combination you used might mean something special.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 16:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573594#M34217</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-15T16:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573598#M34218</link>
      <description>You should be using NWKDOM to find the second Tuesday and then checking if the date matches that date instead. Sorry, I fixed your code, but didn't check to see if it actually did what you wanted, not sure it does. The NWKDOM appraoch will work though.</description>
      <pubDate>Mon, 15 Jul 2019 16:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573598#M34218</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-15T16:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573605#M34219</link>
      <description>&lt;P&gt;This is the full code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
DATA_R=intnx('month',TODAY(),-1,'beginning');
DATA_u=Intnx('month',TODAY(),-1,'end');
DATA_F=COMPRESS(PUT(DATA_R, DATE9.))!!'_'!!TRIM(PUT(DATA_u, DATE9.))!!"_FT";
DATA_A=COMPRESS(PUT(DATA_R, DATE9.))!!'_'!!TRIM(PUT(DATA_u, DATE9.))!!"_AMM";
CALL SYMPUT('TABELLA',DATA_f);	
CALL SYMPUT('AMM',DATA_A);
CALL SYMPUT('DATA_I',DATA_R);
CALL SYMPUT('DATA_U',DATA_U);
FORMAT DATA_R DATA_u DATE9.;
RUN;
%PUT &amp;amp;TABELLA &amp;amp;AMM &amp;amp;DATA_I &amp;amp;DATA_U;
PROC SQL;
CREATE TABLE _&amp;amp;TABELLA AS
SELECT *
FROM WORK.OUT_INVOICES
WHERE Cod_Cliente=104466 AND DATA_FATTURA BETWEEN &amp;amp;DATA_I AND &amp;amp;DATA_U AND Registro_Iva not='V4';
quit;
proc sql;
CREATE TABLE _&amp;amp;AMM AS
SELECT *
FROM WORK.OUT_INVOICES
WHERE Cod_Cliente=104466 AND DATA_FATTURA BETWEEN &amp;amp;DATA_I AND &amp;amp;DATA_U AND Registro_Iva='V4';
QUIT;


%macro export_conditionally;
%if (day(now) between 8 and 14) and workday(now)=2 %then %do;
proc export 
  data=_&amp;amp;TABELLA
  dbms=xlsx 
  outfile="C:\\23- REPORT\FLEET ADV\FLUSSO\EURO\_&amp;amp;TABELLA - EURO.xlsx" 
  replace;
run;
proc export 
  data=_&amp;amp;AMM
  dbms=xlsx 
   outfile="C:\\23- REPORT\FLEET ADV\FLUSSO\EURO\_&amp;amp;AMM - EURO.xlsx" 
  replace;
run;
%end

%mend;
%export_conditionally;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In the if statement i want to export this two file only when is the second monday of the month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank's to all!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 17:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573605#M34219</guid>
      <dc:creator>FRAFLUTE</dc:creator>
      <dc:date>2019-07-15T17:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573632#M34220</link>
      <description>1. Use NWKDOM to find the date of the second Tuesday&lt;BR /&gt;2. Check if that date and today's date are the same. &lt;BR /&gt;&lt;BR /&gt;I don't see anything about that in your code. So not sure why you're posting it all again. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Jul 2019 18:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573632#M34220</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-15T18:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573791#M34234</link>
      <description>&lt;P&gt;Thank's for the support!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below the modified code with the NWKDOM function... but don't run &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be the problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro export_conditionally;
%if %sysfunc(today())=%sysfunc(NWKDOM(2,2,month(today()),year(today()))) %then %do;
proc export 
  data=_&amp;amp;TABELLA
  dbms=xlsx 
  outfile="\23- REPORT\FLEET ADV\FLUSSO RAC\EUROPCAR\_&amp;amp;TABELLA - EUROPCAR.xlsx" 
  replace;
run;
proc export 
  data=_&amp;amp;AMM
  dbms=xlsx 
  outfile="\23- REPORT\FLEET ADV\FLUSSO RAC\EUROPCAR\_&amp;amp;AMM - EUROPCAR.xlsx" 
  replace;
run;
%end

%mend;
%export_conditionally;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 09:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573791#M34234</guid>
      <dc:creator>FRAFLUTE</dc:creator>
      <dc:date>2019-07-23T09:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573810#M34236</link>
      <description>As others have noted, you have logic errors that should be fixed.&lt;BR /&gt;&lt;BR /&gt;However, the first item to fix is the missing semicolon that belongs here:&lt;BR /&gt;&lt;BR /&gt;%end;</description>
      <pubDate>Tue, 16 Jul 2019 12:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573810#M34236</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-07-16T12:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573827#M34237</link>
      <description>&lt;P&gt;The NWKDOM function is not going to know how to deal with the strings MONTH(TODAY()) and YEAR(TODAY()).&lt;/P&gt;
&lt;P&gt;If you want to call a SAS function in macro code then each function needs to enclosed in its own call to the %SYSFUNC() macro function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro export_conditionally;
%local today;
%let today=%sysfunc(today());
%if  &amp;amp;today=%sysfunc(NWKDOM(2,2,%sysfunc(month(&amp;amp;today)),%sysfunc(year(&amp;amp;today)))) %then %do;
proc export 
  data=_&amp;amp;TABELLA
  dbms=xlsx 
  outfile="\\FSITMIVF0230\VLCR$\23- REPORT\FLEET ADV\FLUSSO RAC\EUROPCAR\_&amp;amp;TABELLA - EUROPCAR.xlsx" 
  replace;
run;
proc export 
  data=_&amp;amp;AMM
  dbms=xlsx 
  outfile="\\FSITMIVF0230\VLCR$\23- REPORT\FLEET ADV\FLUSSO RAC\EUROPCAR\_&amp;amp;AMM - EUROPCAR.xlsx" 
  replace;
run;
%end;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jul 2019 12:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573827#M34237</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-16T12:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573831#M34238</link>
      <description>What Tom says about needing %sysfunc for every nonmacro function is correct.  In context you might choose a different path, however.  Your full program includes a DATA _NULL_ step earlier.  That step could use the same functions with zero use of %sysfunc, and generate a macro variable using CALL SYMPUTX.  For example a macro variable Second_monday could be assigned a value of Y or N in that DATA step.</description>
      <pubDate>Tue, 16 Jul 2019 13:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-export-with-if-condition/m-p/573831#M34238</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-07-16T13:17:27Z</dc:date>
    </item>
  </channel>
</rss>

