<?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: need to read text file has zero in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827395#M326827</link>
    <description>Tom...Below I have provided some additional details..&lt;BR /&gt;Can we add a flag that says "Y" or "N"? If changes need to be made, set the flag to "Y" and start the process. If not, the procedure shouldn't start.&lt;BR /&gt;DATA DE_CONVER_ACTS;&lt;BR /&gt;infile "/hf_out.txt" dsd dlm='|' MISSOVER FIRSTOBS=2 end=eof;&lt;BR /&gt;length&lt;BR /&gt;ACCOUNT$ 16&lt;BR /&gt;SYS$ 4&lt;BR /&gt;MEMBER$ 4&lt;BR /&gt;AGENT$ 4&lt;BR /&gt;Date$ 8&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;input&lt;BR /&gt;ACCOUNT$&lt;BR /&gt;SYS$&lt;BR /&gt;PRIN$&lt;BR /&gt;MEMBER $&lt;BR /&gt;Date$&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;</description>
    <pubDate>Fri, 05 Aug 2022 16:38:36 GMT</pubDate>
    <dc:creator>cho16</dc:creator>
    <dc:date>2022-08-05T16:38:36Z</dc:date>
    <item>
      <title>need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827385#M326824</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We aim to add some additional logic to the prod code that already exists. The code should read the text file as though it were a one-time task if any plans needed to be removed from the logic. Otherwise, 0 values must be read from the text file.&lt;BR /&gt;Is it possible to add logic to it in any way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 15:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827385#M326824</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2022-08-05T15:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827388#M326825</link>
      <description>&lt;P&gt;Probably since SAS is a programming language.&lt;/P&gt;
&lt;P&gt;But you need to provide a lot more information about what you are actually doing and what the terms you are using actually mean.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 15:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827388#M326825</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-05T15:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827395#M326827</link>
      <description>Tom...Below I have provided some additional details..&lt;BR /&gt;Can we add a flag that says "Y" or "N"? If changes need to be made, set the flag to "Y" and start the process. If not, the procedure shouldn't start.&lt;BR /&gt;DATA DE_CONVER_ACTS;&lt;BR /&gt;infile "/hf_out.txt" dsd dlm='|' MISSOVER FIRSTOBS=2 end=eof;&lt;BR /&gt;length&lt;BR /&gt;ACCOUNT$ 16&lt;BR /&gt;SYS$ 4&lt;BR /&gt;MEMBER$ 4&lt;BR /&gt;AGENT$ 4&lt;BR /&gt;Date$ 8&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;input&lt;BR /&gt;ACCOUNT$&lt;BR /&gt;SYS$&lt;BR /&gt;PRIN$&lt;BR /&gt;MEMBER $&lt;BR /&gt;Date$&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Aug 2022 16:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827395#M326827</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2022-08-05T16:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827396#M326828</link>
      <description>&lt;P&gt;Explain &lt;STRONG&gt;(in&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;detail!)&lt;/STRONG&gt; what&amp;nbsp;you mean by this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;If changes need to be made&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;and also, what you mean by "process" and "procedure".&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 16:46:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827396#M326828</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-05T16:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827398#M326830</link>
      <description>Our organization has a lot of plans. The vendor will put the file in one place if we wish to eliminate one plan from the extract.&lt;BR /&gt;For instance, the deconversion is a one-time activity for the August release; the same process should not be followed for the September release; again, the deconversion will occur for the November release; hence, there is no need to modify the SAS code; rather, additional conditions must be included.Hope this helps</description>
      <pubDate>Fri, 05 Aug 2022 16:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827398#M326830</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2022-08-05T16:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827400#M326831</link>
      <description>&lt;P&gt;What tool are you using? SAS DIS or Studio/Base?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

%macro run_report(report_run = );
%if &amp;amp;report_run = Y %then %do;

DATA DE_CONVER_ACTS;
infile "/hf_out.txt" dsd dlm='|' MISSOVER FIRSTOBS=2 end=eof;
length
ACCOUNT$ 16
SYS$ 4
MEMBER$ 4
AGENT$ 4
Date$ 8
;

input
ACCOUNT$
SYS$
PRIN$
MEMBER $
Date$
;
run;
%end;

%mend;

%let changes_required = Y;

%run_report(report_run= &amp;amp;changes_required);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;UCLA introductory tutorial on macro variables and macros&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Tutorial on converting a working program to a macro&lt;BR /&gt;&lt;BR /&gt;This method is pretty robust and helps prevent errors and makes it much easier to debug your code. Obviously biased, because I wrote it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Examples of common macro usage&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 17:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827400#M326831</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-05T17:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827403#M326832</link>
      <description>Thanks Reeza..we are using SAS EG</description>
      <pubDate>Fri, 05 Aug 2022 17:03:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827403#M326832</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2022-08-05T17:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827406#M326833</link>
      <description>Do you want a prompt in the process?&lt;BR /&gt;Or set a macro variable at the start of a program? &lt;BR /&gt;Do you have a control program where you set parameters? &lt;BR /&gt;Or is the status of changes required driven by something in the process? &lt;BR /&gt;&lt;BR /&gt;Either way the macro solution above is how you structure the code. Exactly how you incorporate that into your process depends on your process, which we do not have or understand. You could have a prompt for the parameter instead of the LET for example.</description>
      <pubDate>Fri, 05 Aug 2022 17:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827406#M326833</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-05T17:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: need to read text file has zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827466#M326867</link>
      <description>&lt;P&gt;Which variable is the one that indicates if the "process" needs to happen?&lt;/P&gt;
&lt;P&gt;None of those variable names look like they could contain that information.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ACCOUNT&amp;nbsp;SYS&amp;nbsp;MEMBER&amp;nbsp;AGENT&amp;nbsp;Date&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or are you saying that the indicator is whether or not there are any records in the file?&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA DE_CONVER_ACTS;
  if eof then call symputx('nobs',_n_-1);
  infile "/hf_out.txt" dsd dlm='|' MISSOVER FIRSTOBS=2 end=eof;
...
run;

%if &amp;amp;nobs %then %do;
... process that will be skipped ...
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Or are you saying that the indicator is whether or not there is a file?&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(fileexist(/hf_out.txt)) %then %do;
... process that will be skipped ...
%end;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Aug 2022 14:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-read-text-file-has-zero/m-p/827466#M326867</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-06T14:45:48Z</dc:date>
    </item>
  </channel>
</rss>

