<?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: SAS Code to traverse another sas code and get a list of all the variables used in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333500#M62837</link>
    <description>&lt;P&gt;A partial solution may be to start from the other end: Get variables from the datasets of interest (dictionary.columns or sashelp.vcolumn)&lt;/P&gt;
&lt;P&gt;Then search the code files for references to those specific variables.&amp;nbsp; Any comparison should be made in a case-insensitive manner as your programmers are likely to have ThisVarName, thisvarname, Thisvarname, ThisvarName and such in the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: I hope you don't have any variables that match SAS supplied functions or keywords such as DATE, MAX, MIN, MEAN and so forth as differentiating between Variable, Function, Proc name, and procedure options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or take a class on compiler construction in a computer science course to understand more of the issues surrounding parsing computer code.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Feb 2017 17:47:30 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-02-16T17:47:30Z</dc:date>
    <item>
      <title>SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/332896#M62801</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;need to write a SAS Code to be able read through another SAS code and get a list of all the variables used. Is that possible and if so then how?&lt;/P&gt;
&lt;P&gt;Please suggest, thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 04:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/332896#M62801</guid>
      <dc:creator>Ritz</dc:creator>
      <dc:date>2017-02-15T04:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/332898#M62802</link>
      <description>&lt;P&gt;Go to lexjansen.com and search for parsers. You should also take a look at PROC SCAPROC.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your programs have macros this is infinitely more difficult.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 04:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/332898#M62802</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-15T04:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/332920#M62803</link>
      <description>&lt;P&gt;Concur with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;. As soon as you use macro elements, resolving those will become a nightmare.&lt;/P&gt;
&lt;P&gt;And variables are often "used" in SAS by not using them in the code. A simple set statement will put all variables in a dataset into the PDV without any of them being explicitly named. So you would need to resolve the whole contents of the dataset to determine the variables present in the data step.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 08:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/332920#M62803</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-15T08:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333069#M62814</link>
      <description>&lt;P&gt;Not too mention indirect references such as variable lists, especially ones like var:&amp;nbsp;&amp;nbsp;_numeric_ _character_ and _all_&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 16:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333069#M62814</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-15T16:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333176#M62819</link>
      <description>So, if the sas code to be parsed has macros, then this is technically an impossible task?</description>
      <pubDate>Wed, 15 Feb 2017 21:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333176#M62819</guid>
      <dc:creator>Ritz</dc:creator>
      <dc:date>2017-02-15T21:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333206#M62820</link>
      <description>&lt;P&gt;Nothing is impossible, but it will take time. Like "see you in 2050".&lt;/P&gt;
&lt;P&gt;Tools like that (think SCAPROC) are developed by &lt;U&gt;teams&lt;/U&gt;&amp;nbsp;over &lt;U&gt;years&lt;/U&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 22:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333206#M62820</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-15T22:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333500#M62837</link>
      <description>&lt;P&gt;A partial solution may be to start from the other end: Get variables from the datasets of interest (dictionary.columns or sashelp.vcolumn)&lt;/P&gt;
&lt;P&gt;Then search the code files for references to those specific variables.&amp;nbsp; Any comparison should be made in a case-insensitive manner as your programmers are likely to have ThisVarName, thisvarname, Thisvarname, ThisvarName and such in the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: I hope you don't have any variables that match SAS supplied functions or keywords such as DATE, MAX, MIN, MEAN and so forth as differentiating between Variable, Function, Proc name, and procedure options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or take a class on compiler construction in a computer science course to understand more of the issues surrounding parsing computer code.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 17:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333500#M62837</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-16T17:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333504#M62838</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;A partial solution may be to start from the other end: Get variables from the datasets of interest (dictionary.columns or sashelp.vcolumn)&lt;/P&gt;
&lt;P&gt;Then search the code files for references to those specific variables.&amp;nbsp; Any comparison should be made in a case-insensitive manner as your programmers are likely to have ThisVarName, thisvarname, Thisvarname, ThisvarName and such in the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: I hope you don't have any variables that match SAS supplied functions or keywords such as DATE, MAX, MIN, MEAN and so forth as differentiating between Variable, Function, Proc name, and procedure options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or take a class on compiler construction in a computer science course to understand more of the issues surrounding parsing computer code.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I use max/min/mean all the time &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's going to be an interesting exercise. It's nice in theory, try to determine what variables are being used. But this is basically where human knowledge of processes is important. Assuming that technology can solve a lack of documentation is a flawed idea.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 17:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/333504#M62838</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-16T17:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to traverse another sas code and get a list of all the variables used</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/334199#M62861</link>
      <description>&lt;P&gt;SAS has a procedure that can analyze SAS programs&amp;nbsp;&lt;EM&gt;as you run them&lt;/EM&gt; -- &lt;A href="http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#p0sf63lx4fs2m5n14qv1bn8p863v.htm" target="_self"&gt;it's called PROC SCAPROC&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This procedure generates a detailed log file with data set names and variable names and attributes -- any data that the program reads and writes is captured.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use SAS Enterprise Guide, you can use &lt;STRONG&gt;Program-&amp;gt;Analyze-&amp;gt;Analyze for Program Flow&lt;/STRONG&gt; to see an example of the detailed output. &amp;nbsp;Try it with a simple program, allow it to create a process flow, and then look at the Note item that the process adds to the flow. &amp;nbsp;Here's an excerpt:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    Data Sets (Count=2)
        SASHELP.CARS  Type=DATA  Field count=15  Access=INPUT  Mode=SEQUENTIAL
          Path='C:\Program Files\SASHome\SASFoundation\9.4\core\sashelp'
            Make  Type=CHARACTER  Length=13
            Model  Type=CHARACTER  Length=40
            Type  Type=CHARACTER  Length=8
            Origin  Type=CHARACTER  Length=6
            DriveTrain  Type=CHARACTER  Length=5
            MSRP  Type=NUMERIC  Length=8  Format=DOLLAR8.
            Invoice  Type=NUMERIC  Length=8  Format=DOLLAR8.
            EngineSize  Type=NUMERIC  Length=8  Label="Engine Size (L)"
&lt;/PRE&gt;
&lt;P&gt;Also check&amp;nbsp;&lt;A href="http://support.sas.com/kb/58/047.html" target="_self"&gt;Sample 58047: Parse output from PROC SCAPROC to create a data set with inputs and outputs&lt;/A&gt;&amp;nbsp; -- a sample that provides an example program that can parse the output of SCAPROC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This approach captures all data variables that are read and written, even if your program does not explicitly name them.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 17:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-Code-to-traverse-another-sas-code-and-get-a-list-of-all-the/m-p/334199#M62861</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-02-19T17:57:44Z</dc:date>
    </item>
  </channel>
</rss>

