<?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: How to do a proc export only on Tuesday in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442971#M282810</link>
    <description>&lt;P&gt;afaik, you cannot have a proc export within a datastep. try macro programming instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro _xprt;&lt;/P&gt;
&lt;P&gt;%if sysfunc(&lt;FONT face="Courier New" size="2"&gt;WEEKDAY(today())) =&amp;nbsp;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;3 %then %do;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;EXPORT&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= RLWORK.prova&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUTFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"DIRECTORY"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=DLM&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;REPLACE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LABEL;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;DELIMITER=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'3B'x&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;PUTNAMES=YES;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;%mend _xprt;&lt;/P&gt;
&lt;P&gt;%_xprt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 17:26:20 GMT</pubDate>
    <dc:creator>saspert</dc:creator>
    <dc:date>2018-03-06T17:26:20Z</dc:date>
    <item>
      <title>How to do a proc export only on Tuesday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442967#M282808</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my need is to execute a proc export all the days in the programme, but i want to obtain the output file only if the day of the week is tuesday. Could you please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a datastep like this but it doesn't work. Why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; WEEKDAY(today())=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;EXPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= RLWORK.prova&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;OUTFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"DIRECTORY"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=DLM &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;REPLACE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; LABEL;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;DELIMITER=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'3B'x&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PUTNAMES=YES;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 17:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442967#M282808</guid>
      <dc:creator>Tiri6</dc:creator>
      <dc:date>2018-03-06T17:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a proc export only on Tuesday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442969#M282809</link>
      <description>You need some macro logic here. &lt;BR /&gt;If you aren't on latest maintenance level you need to wrap you code inside a macro, and in there do %If on the weekday.&lt;BR /&gt;The alternative is to do he test in a data step, and if positive issue a call execute that contains your PROC EXPORT.</description>
      <pubDate>Tue, 06 Mar 2018 17:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442969#M282809</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-03-06T17:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a proc export only on Tuesday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442971#M282810</link>
      <description>&lt;P&gt;afaik, you cannot have a proc export within a datastep. try macro programming instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro _xprt;&lt;/P&gt;
&lt;P&gt;%if sysfunc(&lt;FONT face="Courier New" size="2"&gt;WEEKDAY(today())) =&amp;nbsp;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;3 %then %do;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;EXPORT&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= RLWORK.prova&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUTFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"DIRECTORY"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=DLM&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;REPLACE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LABEL;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;DELIMITER=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'3B'x&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;PUTNAMES=YES;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;%mend _xprt;&lt;/P&gt;
&lt;P&gt;%_xprt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 17:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442971#M282810</guid>
      <dc:creator>saspert</dc:creator>
      <dc:date>2018-03-06T17:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a proc export only on Tuesday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442979#M282811</link>
      <description>&lt;P&gt;Here's an example of &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;call execute suggestion:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
   if WEEKDAY(today())=3 then do;
      Call execute ('PROC EXPORT DATA= RLWORK.prova
      OUTFILE= "DIRECTORY"
      DBMS=DLM REPLACE LABEL;
      DELIMITER="3B"x; 
      PUTNAMES=YES;
      RUN;');
   end;
run;&lt;/PRE&gt;
&lt;P&gt;Assumes of course that your outfile is substituted with something that will work. Not sure why you are using the hex "3B"x instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;";" though.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 17:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442979#M282811</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-06T17:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a proc export only on Tuesday</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442999#M282812</link>
      <description>Well you can't execute a PROC within a data step, but you can issue/call it. Either with CALL EXECUTE that holds the PROC code (as shown by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;), or to a macro that holds the program.&lt;BR /&gt;Either way, the PROC will be queued and execute right after data step termination.</description>
      <pubDate>Tue, 06 Mar 2018 18:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-proc-export-only-on-Tuesday/m-p/442999#M282812</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-03-06T18:31:00Z</dc:date>
    </item>
  </channel>
</rss>

