<?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: Indentify blank lines when reading in a file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558511#M155874</link>
    <description>&lt;P&gt;have you tried&lt;/P&gt;
&lt;P&gt;if compress(line) = "" then blank_ind = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2019 01:51:08 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2019-05-14T01:51:08Z</dc:date>
    <item>
      <title>Indentify blank lines when reading in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558510#M155873</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; I have a program that reads in a file one line at a time.&amp;nbsp; The entire line is read in as a single variable named LINE.&amp;nbsp; As each line is read in I'm trying to determine if the entire line is blank and flag it with an indicator.&amp;nbsp; Is there a good way to do this?&amp;nbsp; I tried this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if line='' then blank_ind =1;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it's not working. Maybe I have to search for all blanks ending with a special character like a carriage return or something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions would be great.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 01:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558510#M155873</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-05-14T01:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Indentify blank lines when reading in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558511#M155874</link>
      <description>&lt;P&gt;have you tried&lt;/P&gt;
&lt;P&gt;if compress(line) = "" then blank_ind = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 01:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558511#M155874</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-05-14T01:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Indentify blank lines when reading in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558512#M155875</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;But it's not working.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What's not working?&amp;nbsp; Could your data contain non-printing characters?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   length line clean_line $10 flag1 flag2 8;
   infile datalines4;
   input;
   line=_infile_;
   if _n_=3 then line="00"x;
   clean_line=compress(line,,"kw");
   flag1=missing(line);
   flag2=missing(clean_line);
   putlog (line clean_line) (=$hex20.);
   datalines;
foo
bar
   
blah
;;;;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then view the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 01:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558512#M155875</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-14T01:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Indentify blank lines when reading in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558514#M155876</link>
      <description>&lt;P&gt;Please show example of how you are reading the lines as the right answer will depend on how you are reading the file.&amp;nbsp; For example if you use the FLOWOVER option on the INFILE statement (which is the default behavior) then SAS will essentially skip the empty lines since it will go looking for the values to satisfy the INPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on how you are reading the file you can test if the line was blank.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _infile_=' ' then .....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also use the LENGTH= on the INFILE statement to have SAS set the value of a variable to the length of the line. Then you could distinguish between a blank line and line with no characters at all.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile ... length=line_length .... ;
....
if line_length=0 then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 02:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indentify-blank-lines-when-reading-in-a-file/m-p/558514#M155876</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-14T02:32:32Z</dc:date>
    </item>
  </channel>
</rss>

