<?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 How to count the number of lines in sas code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776199#M246811</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know, if there is any code that counts the lines in the sas code.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Soujanya&lt;/P&gt;</description>
    <pubDate>Mon, 25 Oct 2021 14:06:34 GMT</pubDate>
    <dc:creator>soujanyak</dc:creator>
    <dc:date>2021-10-25T14:06:34Z</dc:date>
    <item>
      <title>How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776199#M246811</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know, if there is any code that counts the lines in the sas code.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Soujanya&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 14:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776199#M246811</guid>
      <dc:creator>soujanyak</dc:creator>
      <dc:date>2021-10-25T14:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776204#M246813</link>
      <description>&lt;P&gt;You can read a SAS program file like any other text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question to you would be your definition of "line" in this case. Easy to count line feeds, other wise you have to parse code if you want "logical" lines, means start to end of a statement (those pesky ; characters).&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 14:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776204#M246813</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-25T14:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776205#M246814</link>
      <description>&lt;P&gt;Try looking at this post and see if it helps with your question:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Reporting-the-SAS-Code-Lines-by-Program/td-p/600902" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Reporting the SAS Code Lines by Program&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 14:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776205#M246814</guid>
      <dc:creator>brzcol</dc:creator>
      <dc:date>2021-10-25T14:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776216#M246819</link>
      <description>&lt;P&gt;If you are in the SAS Windowing Environment&lt;BR /&gt;Turn on NUMS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AMSAS_0-1635176125169.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65003iF48B771FE5651C94/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AMSAS_0-1635176125169.png" alt="AMSAS_0-1635176125169.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 15:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/776216#M246819</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2021-10-25T15:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831898#M328799</link>
      <description>&lt;P&gt;Is it possible to exclude blank lines from the script ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 11:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831898#M328799</guid>
      <dc:creator>bebess</dc:creator>
      <dc:date>2022-09-06T11:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831899#M328800</link>
      <description>exclude them in the count</description>
      <pubDate>Tue, 06 Sep 2022 11:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831899#M328800</guid>
      <dc:creator>bebess</dc:creator>
      <dc:date>2022-09-06T11:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831901#M328802</link>
      <description>&lt;P&gt;Very simple code to get the lines into a SAS Data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data lines;
   infile "Path";
   input;
   line = _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From there, it should be easy to count the non blank lines.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 11:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831901#M328802</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-06T11:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831905#M328805</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path = /home/myself/sas_programs;

data lines;
length filename fvar $200;
retain filename count;
infile "&amp;amp;path./*.sas" filename=fvar end=done;
input;
if fvar ne filename or done
then do;
  if filename ne ""
  then do;
    if done and _infile_ &amp;gt; " " then count + 1;
    output;
  end;
  count = 0;
  filename = fvar;
end;
if _infile_ &amp;gt; " " then count + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will count all non-empty lines in all SAS programs in the directory.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 12:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831905#M328805</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-09-06T12:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831988#M328838</link>
      <description>&lt;P&gt;Nice line counting program. I'm just wondering if the criterion for non-empty lines should rather be&amp;nbsp;&lt;FONT face="courier new,courier"&gt;_infile_ &lt;EM&gt;&lt;STRONG&gt;ne&lt;/STRONG&gt;&lt;/EM&gt; " "&lt;/FONT&gt; to include lines in the count that are indented with ugly tab characters (&lt;FONT face="courier new,courier"&gt;'09'x &amp;lt; '20'x = " "&lt;/FONT&gt;&amp;nbsp;in ASCII).&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 16:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/831988#M328838</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-09-06T16:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the number of lines in sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/832081#M328873</link>
      <description>&lt;P&gt;Yes you're right i've checked and it works fine : thanks to both of you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let path = /home/myself/sas_programs;;&lt;/P&gt;&lt;P&gt;data lines;&lt;BR /&gt;length filename fvar $200;&lt;BR /&gt;retain filename count;&lt;BR /&gt;infile "&amp;amp;path./*.sas" filename=fvar end=done;&lt;BR /&gt;input;&lt;BR /&gt;if fvar ne filename or done&lt;BR /&gt;then do;&lt;BR /&gt;if filename ne ""&lt;BR /&gt;then do;&lt;BR /&gt;if done and _infile_ ne " " then count + 1;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;count = 0;&lt;BR /&gt;filename = fvar;&lt;BR /&gt;end;&lt;BR /&gt;if _infile_ ne " " then count + 1;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 08:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-count-the-number-of-lines-in-sas-code/m-p/832081#M328873</guid>
      <dc:creator>bebess</dc:creator>
      <dc:date>2022-09-07T08:40:08Z</dc:date>
    </item>
  </channel>
</rss>

