<?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: output touch file (empty file) when processing is done in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556775#M155124</link>
    <description>&lt;P&gt;Thanks for your input,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i changed logic and came up with this, can i make this better?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%macro test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%let todaysdate=%sysfunc(today(), date8.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;%put &amp;amp;todaysdate;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*have temp dataset which has "Date" variable like 05May2019*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;libname mylib "/path";&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;set mylib.test1 nobs=n;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;call symput ("nobs", n);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;call symput ("tempdate",put(Date, date8.));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%put &amp;amp;nobs;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%if &amp;amp;nobs. &amp;gt;= 1 and &amp;amp;todaysdate.=&amp;amp;tempdate. %then&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data test;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;set sashelp.stocks;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*output results in text files*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc export data=test outfile='/sharedrive/datafile1.txt' dbms=tab replace;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;putnames=no;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*touch file after export is done */&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%let testfile1="/sharedrive/datafile1.txt";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%if %sysfunc(fileexist(&amp;amp;testfile1)) %then do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;infile "cd /sharedrive; touch datafile1_ready.txt;" pipe;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*same logic, export + touchfile, for file2 and file3*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*same logic for other two text files*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%else&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;filename mymail email "email"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;subject="sas data ready alert ";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;file mymail;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;put "Hello team,";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;put "input file doesn't have enough data";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;%mend;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%test&lt;/FONT&gt;;&lt;/P&gt;</description>
    <pubDate>Tue, 07 May 2019 13:49:00 GMT</pubDate>
    <dc:creator>woo</dc:creator>
    <dc:date>2019-05-07T13:49:00Z</dc:date>
    <item>
      <title>output touch file (empty file) when processing is done</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556409#M155004</link>
      <description>&lt;P&gt;Hello, i have to read db tables when&lt;/P&gt;
&lt;P&gt;1) db table is fully loaded for a day (loading time is very in between specific time, lets say 1 am to 3 am) then i do some processing&lt;/P&gt;
&lt;P&gt;2) at end of the process, i have to export 3 sas dataset into 3 different text file and once this export is done - i want to create 3 file (lets say simple empty text file without any data) which says okay, data files are out there and ready - so that other process (not SAS from now on) can read that empty file and further processing can happen - how to output empty file (touch file) once export is done,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; data _null_;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set sashelp.stocks;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call symput ("nofobs", _n_);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;nofobs;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;nofobs. &amp;gt;= 1 and Date = '1Aug2003'd %then&lt;BR /&gt;%do;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;data test;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set sashelp.stocks;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*output text files*/&lt;BR /&gt;proc export data=test outfile='some share drive\datafile1.txt' dbms=tab replace;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;putnames=no;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=test2 outfile='some share drive\datafile2.txt' dbms=tab replace;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;putnames=no;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=test3 outfile='some share drive\datafile3.txt' dbms=tab replace;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;putnames=no;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*once those three text file done, want to touch empty 3 file */&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;/*some logic */&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename mymail email "email"&lt;BR /&gt;subject="sas data ready alert ";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;file mymail;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;put "Hello team,";&lt;BR /&gt;&amp;nbsp; &amp;nbsp;put "SAS output is avilable, plese use data and process further";&lt;BR /&gt;&amp;nbsp; &amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%else %do;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;filename mymail email "email"&lt;BR /&gt;subject="oracle table alert";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;file mymail;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;put "Hello team,";&lt;BR /&gt;&amp;nbsp; &amp;nbsp;put "Table doesn't have enough records, sas is not going to process the table";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;%test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 13:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556409#M155004</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2019-05-06T13:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: output touch file (empty file) when processing is done</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556660#M155088</link>
      <description>&lt;P&gt;1. Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   file "&amp;amp;path\name1.txt";
   put ' ';
   file "&amp;amp;path\name2.txt";
   put ' ';
   file "&amp;amp;path\name3.txt";
   put ' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2. This test will never be true:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;%if Date = '1Aug2003'd&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. Correct the many spelling errors.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 04:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556660#M155088</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-07T04:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: output touch file (empty file) when processing is done</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556668#M155093</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; data _null_;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set sashelp.stocks;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call symput ("nofobs", _n_);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; run;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What if sashelp.stocks is 100M records?&amp;nbsp; You're going to call symput() 100M times, overwriting nofobs 100M times, only to save the last result.&amp;nbsp; That is, ahem, "inefficient".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Number of observations != empty/not empty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a look at&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/scottbass/SAS/blob/master/Macro/nobs.sas" target="_blank" rel="noopener"&gt;https://github.com/scottbass/SAS/blob/master/Macro/nobs.sas&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/scottbass/SAS/blob/master/Macro/check_if_empty.sas" target="_blank" rel="noopener"&gt;https://github.com/scottbass/SAS/blob/master/Macro/check_if_empty.sas&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;/*once those three text file done, want to touch empty 3 file */&lt;/SPAN&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;/*some logic */&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why do you need to create three marker files?&amp;nbsp; If this is just to control downstream processing, then isn't one marker file enough?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are the marker files meant to be the same name as your exported files?&amp;nbsp; If so, of course create them before your export, otherwise they will overwrite your exported SAS files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FWIW, I usually implemented the logic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If marker file exists then ETL is running, don't run downstream code.&lt;/P&gt;&lt;P&gt;If marker file does not exist then upstream ETL was successful, run downstream code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then create the "ETL is running" marker file at the beginning of the ETL, and delete the marker file when the success condition is met.&amp;nbsp; The downstream ETL loops while the marker file exists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then if I come in the morning and the marker file exists I know where the error occurred.&amp;nbsp; Of course, the email tells me that too :).&amp;nbsp; I then fix the issue, manually delete the marker file, then re-run the downstream ETL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, you might be able to steal some of the logic in here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/scottbass/SAS/blob/master/Macro/lock.sas" target="_blank" rel="noopener"&gt;https://github.com/scottbass/SAS/blob/master/Macro/lock.sas&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/scottbass/SAS/blob/master/Macro/marker.sas" target="_blank"&gt;https://github.com/scottbass/SAS/blob/master/Macro/marker.sas&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not exactly what you're looking for but may give you some ideas...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 05:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556668#M155093</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-07T05:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: output touch file (empty file) when processing is done</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556775#M155124</link>
      <description>&lt;P&gt;Thanks for your input,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i changed logic and came up with this, can i make this better?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%macro test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%let todaysdate=%sysfunc(today(), date8.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;%put &amp;amp;todaysdate;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*have temp dataset which has "Date" variable like 05May2019*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;libname mylib "/path";&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;set mylib.test1 nobs=n;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;call symput ("nobs", n);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;call symput ("tempdate",put(Date, date8.));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%put &amp;amp;nobs;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%if &amp;amp;nobs. &amp;gt;= 1 and &amp;amp;todaysdate.=&amp;amp;tempdate. %then&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data test;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;set sashelp.stocks;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*output results in text files*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc export data=test outfile='/sharedrive/datafile1.txt' dbms=tab replace;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;putnames=no;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*touch file after export is done */&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%let testfile1="/sharedrive/datafile1.txt";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%if %sysfunc(fileexist(&amp;amp;testfile1)) %then do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;infile "cd /sharedrive; touch datafile1_ready.txt;" pipe;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*same logic, export + touchfile, for file2 and file3*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;/*same logic for other two text files*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%else&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;filename mymail email "email"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;subject="sas data ready alert ";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;file mymail;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;put "Hello team,";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;put "input file doesn't have enough data";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;%mend;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;%test&lt;/FONT&gt;;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 13:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556775#M155124</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2019-05-07T13:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: output touch file (empty file) when processing is done</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556921#M155195</link>
      <description>&lt;P&gt;What types of values would DATE8. format generate?&amp;nbsp; DATE needs 9 characters, 2 for day, 3 for month and 4 for year.&lt;/P&gt;
&lt;P&gt;Use DATE9.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't use the old style CALL SYMPUT(). Use the newer CALL SYMPUTX() instead.&lt;/P&gt;
&lt;P&gt;if the input dataset is empty the step will stop at the SET statement and never get to the CALL SYMPUTX() statement.&amp;nbsp; So write&amp;nbsp;the value of NOBS macro variable BEFORE the SET statement. And make sure to define TEMPDATE macro variable in case there are no observations in the dataset.&amp;nbsp; No need to read the whole dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let tempdate=UNKNOWN;
data _null_;
  call symputX("nobs", n);
  set mylib.test1 nobs=n;
  call symputX("tempdate",put(Date, date9.));
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 19:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-touch-file-empty-file-when-processing-is-done/m-p/556921#M155195</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-07T19:29:10Z</dc:date>
    </item>
  </channel>
</rss>

