<?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: Comment reading in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237825#M43629</link>
    <description>Beyond what everyone else has stated, there are code parsers for comments for SAS that do exist. Search lexjansen.com and/or Google in general.  &lt;BR /&gt;&lt;BR /&gt;Here's a quick result from &amp;lt;1min of googling. Good Luck.&lt;BR /&gt;&lt;A href="http://www.lexjansen.com/phuse/2014/ad/AD09.pdf" target="_blank"&gt;http://www.lexjansen.com/phuse/2014/ad/AD09.pdf&lt;/A&gt;</description>
    <pubDate>Fri, 04 Dec 2015 15:20:25 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-12-04T15:20:25Z</dc:date>
    <item>
      <title>Comment reading</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237768#M43604</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;I need to report the comments written in SAS programs, as there are many of them I need help&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Programs which reside in z/Os PDS members&amp;nbsp;contain single and multi line comments, I need to generate a report which contains the comments present in the program (i.e. PDS member) with the name of that PDS member &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;For ex. if&amp;nbsp;below program is preset in members called A01 &amp;amp; A02 in PDS library ABC.DEF.GHI &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="courier new,courier"&gt;* OPTIONS ;
  OPTIONS MLOGIC MPRINT SYMBOLGEN ;

* DEFINE A MACRO CALLED READ ;
  %MACRO READ ;
     DATA _NULL_ ;
       PUT 'READING' ;
     RUN ;
  %MEND READ ;

/* EXECUTE THE MACRO WHICH HAS BEEN - 
   ALREADY DEFINED */

  %READ ;
&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Then the reportt should be as below &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;ABC.DEF.GHI(A01)&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;* OPTIONS ;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;* DEFINE A MACRO CALLED READ ;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;/* EXECUTE THE MACRO WHICH HAS BEEN - &lt;BR /&gt;&amp;nbsp;&amp;nbsp; ALREADY DEFINED */&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;ABC.DEF.GHI(A02)&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;* OPTIONS ;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;* DEFINE A MACRO CALLED READ ;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;/* EXECUTE THE MACRO WHICH HAS BEEN - &lt;BR /&gt;&amp;nbsp;&amp;nbsp; ALREADY DEFINED */&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;The code which generates above report need to take PDS name as the input parameter, read all the members inside that PDS and generate the report as above.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Could anyone please help?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 10:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237768#M43604</guid>
      <dc:creator>nrk1787db1</dc:creator>
      <dc:date>2015-12-04T10:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Comment reading</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237773#M43609</link>
      <description>&lt;P&gt;A simple data step that uses SAS programs as INFILE filenames, and just keep observations that starts with *.&lt;/P&gt;
&lt;P&gt;For the /* */ on multiple line, you probably&amp;nbsp;need some&amp;nbsp;kind of retain logic to make that work.&lt;/P&gt;
&lt;P&gt;I hope that program are well structured so that comments isn't part of lines, then you logic will rapidly build up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps the SAS code analyzer is a more solid alternative, even if can't you 100% the output&amp;nbsp;you are looking for?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 10:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237773#M43609</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-12-04T10:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Comment reading</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237774#M43610</link>
      <description>&lt;P&gt;I am afraid what you are asking for is for someone to write a text parser for you. &amp;nbsp;This isn't a specific question. &amp;nbsp;It can get quite complicated, sure its simple to open a file for read, and read it in line by line searching for "/*", "*" etc., however you also have to then contend with nested comments, missing end of strings, * being used as multiplier, commented code etc. &amp;nbsp;Its not a trivial task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a good example of why documentation is far more important than programming in the modern world. &amp;nbsp;If you follow Software Development Lifecycle process, your Functional Design Specification will already have the neccessary information contained within it, version history would be in the Version Control software, as would changes, so no comments.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 10:30:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237774#M43610</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-12-04T10:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Comment reading</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237775#M43611</link>
      <description>Thank you;&lt;BR /&gt;I thought it is not as simple as it sounds!!</description>
      <pubDate>Fri, 04 Dec 2015 10:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237775#M43611</guid>
      <dc:creator>nrk1787db1</dc:creator>
      <dc:date>2015-12-04T10:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Comment reading</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237788#M43620</link>
      <description>&lt;P&gt;It would become an easy problem in the future, if you could impose coding standards for comments. &amp;nbsp;While there are a few possibilities for workable standards, here would be one way to create the right environment going forward.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The original comments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;* OPTIONS;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;* DEFINE A MACRO CALLED READ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/* EXECUTE THE MACRO WHICH HAS BEEN - &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;ALREADY DEFINED */&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The new style:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/** OPTIONS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;**/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/** DEFINE A MACRO CALLED READ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; **/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/** EXECUTE THE MACRO WHICH HAS BEEN - **/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/** ALREADY DEFINED &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;**/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 11:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237788#M43620</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-12-04T11:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Comment reading</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237798#M43624</link>
      <description>&lt;P&gt;Whilst coding standards would help, I can pretty much guarantee that with a few different programmers you will start to see non-compliance with it, mistakes, not being updated in line with code etc. &amp;nbsp;Even two programmers find it hard. &amp;nbsp;This is why I would go with a standard header which has minimal information, and leave the Version control software to handle changes/comments etc. &amp;nbsp;You can even force information via hooks if necessary. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 12:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237798#M43624</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-12-04T12:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Comment reading</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237825#M43629</link>
      <description>Beyond what everyone else has stated, there are code parsers for comments for SAS that do exist. Search lexjansen.com and/or Google in general.  &lt;BR /&gt;&lt;BR /&gt;Here's a quick result from &amp;lt;1min of googling. Good Luck.&lt;BR /&gt;&lt;A href="http://www.lexjansen.com/phuse/2014/ad/AD09.pdf" target="_blank"&gt;http://www.lexjansen.com/phuse/2014/ad/AD09.pdf&lt;/A&gt;</description>
      <pubDate>Fri, 04 Dec 2015 15:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comment-reading/m-p/237825#M43629</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-04T15:20:25Z</dc:date>
    </item>
  </channel>
</rss>

