<?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 find all table name in sas program ( prod sql) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923024#M363410</link>
    <description>&lt;P&gt;Hi, I have very log code using proc sql and retrieve data from lot of tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for any code which I can use to see only all the table name in code ( like i need list of the tables that are used in the program )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me&lt;/P&gt;</description>
    <pubDate>Thu, 04 Apr 2024 18:16:15 GMT</pubDate>
    <dc:creator>soujik</dc:creator>
    <dc:date>2024-04-04T18:16:15Z</dc:date>
    <item>
      <title>How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923024#M363410</link>
      <description>&lt;P&gt;Hi, I have very log code using proc sql and retrieve data from lot of tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for any code which I can use to see only all the table name in code ( like i need list of the tables that are used in the program )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 18:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923024#M363410</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2024-04-04T18:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923031#M363415</link>
      <description>&lt;P&gt;all the program are in sas viya...please help to see the list of table name that are used in sas program&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 18:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923031#M363415</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2024-04-04T18:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923085#M363433</link>
      <description>&lt;P&gt;Check PROC SCAPROC . Some code like the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc scaproc;
record 'c:\temp\temp.txt';
run;

/****Your code here****/
data have;
 set sashelp.class;
run;
proc print data=sashelp.heart(obs=1);run;


proc scaproc;
write;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And open "&lt;CODE class=" language-sas"&gt;c:\temp\temp.txt&lt;/CODE&gt;"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1712286018693.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95225iD42A8F6FFF4D7E88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1712286018693.png" alt="Ksharp_0-1712286018693.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 03:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923085#M363433</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-05T03:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923092#M363436</link>
      <description>&lt;P&gt;To add to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;wrote: Using Viya you can use global macro variable &amp;amp;_userhome to write the output to your home location.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc scaproc;
  record "&amp;amp;_userhome/temp.txt";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1712290235545.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95228i711AF8049232BDEC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1712290235545.png" alt="Patrick_0-1712290235545.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 04:15:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923092#M363436</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-04-05T04:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923244#M363495</link>
      <description>&lt;P&gt;Thank you but I have all my codes ( around 20 sas programs ) in this below sas directory. please help me how can i get all the table names from &lt;STRONG&gt;all sas programs&lt;/STRONG&gt; which is in below directory&lt;/P&gt;&lt;P&gt;/cloud/pvxxx-123/mktprfl/890091254/daily_xref/code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 20:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923244#M363495</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2024-04-05T20:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923247#M363497</link>
      <description>Thank you, but I have all sas codes ( around 20 sas programs) in below directory. i would like to get all table names from that all sas programs.&lt;BR /&gt;&lt;BR /&gt;/cloud/pvxxx-123/mktprf/89009321/code/&lt;BR /&gt;sample sas program name&lt;BR /&gt;/cloud/pvxxx-123/mktprf/89009321/code/ext_xpo_map.sas</description>
      <pubDate>Fri, 05 Apr 2024 20:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923247#M363497</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2024-04-05T20:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923252#M363502</link>
      <description>&lt;P&gt;all sas program running&amp;nbsp; logs are writing into log directory&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/cloud/pvxxx-123/mktprf/89009321/log&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;please help me to get all from table names for proc sql&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 21:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923252#M363502</guid>
      <dc:creator>soujik</dc:creator>
      <dc:date>2024-04-05T21:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923254#M363503</link>
      <description>&lt;P&gt;If proc scaproc won't work for you there is likely to be no magic simple solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Parsing code text runs into complications quickly.&lt;/P&gt;
&lt;P&gt;Consider, do you use macro variables to create any of the names? or macro expressions that result in a name?&lt;/P&gt;
&lt;P&gt;Which procedures do you use? Some procedures can have many different input or output data sets depending on the procedure. For example Proc Survey select on the the Proc statement may have data sets referenced as:&lt;/P&gt;
&lt;P&gt;Data = (pretty common)&lt;/P&gt;
&lt;P&gt;Out = (also pretty common)&lt;/P&gt;
&lt;P&gt;Outsort=&lt;/P&gt;
&lt;P&gt;Certsize=&lt;/P&gt;
&lt;P&gt;Maxsize=&lt;/P&gt;
&lt;P&gt;Minsize=&lt;/P&gt;
&lt;P&gt;Samprate= (or rate=)&lt;/P&gt;
&lt;P&gt;Sampsize= (or N=)&lt;/P&gt;
&lt;P&gt;Seed=&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And while the above options can take a data set as input they also accept single or lists of values numeric values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does every single data step provide the name of an output data set? Does every single procedure have an input data set? SAS provides use of _last_, which need not appear in the code, where such aren't explicitly stated and trying to line up output that creates the specific _last_ may not be a trivial exercise.&lt;/P&gt;
&lt;P&gt;If you don't know what I mean try running this very trivial code:&lt;/P&gt;
&lt;PRE&gt;data ;
  x= 1;
run;

data ;
  y=2;
run;&lt;/PRE&gt;
&lt;P&gt;Now look in your log. You may see something like:&lt;/P&gt;
&lt;PRE&gt;112  data ;
113    x= 1;
114  run;

NOTE: The data set WORK.DATA1 has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


115
116  data ;
117    y=2;
118  run;

NOTE: The data set WORK.DATA2 has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time
&lt;/PRE&gt;
&lt;P&gt;Which on my system created data sets Work.Data1 and Work.Data2. But that is not possible to tell from parsing the code. And if someone uses similar code without explicit names you might have seen WORK.DATA33.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, just how many options does your code use that might reference a data set? If we have to provide something that will find "every data set used" we have to write next to the equivalent of the SAS code to parse yours to find the sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then there is the syntax used by ODS OUTPUT to create data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can likely look for simple DATA = , Set= , Data, Out= and maybe a few others. But generic code to find every single one in a robust reliable manner is sort of beyond simple help.&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;
&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, 05 Apr 2024 21:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923254#M363503</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-05T21:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923267#M363508</link>
      <description>You could make a new sas program file and put them all together. Like :&lt;BR /&gt;&lt;BR /&gt;proc scaproc;&lt;BR /&gt;record 'c:\temp\temp.txt';&lt;BR /&gt;run;&lt;BR /&gt;%include '/cloud/pvxxx-123/mktprf/89009321/code/*.sas';&lt;BR /&gt;proc scaproc;&lt;BR /&gt;write;&lt;BR /&gt;run;</description>
      <pubDate>Sat, 06 Apr 2024 04:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923267#M363508</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-06T04:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all table name in sas program ( prod sql)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923269#M363509</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/441250"&gt;@soujik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you, but I have all sas codes ( around 20 sas programs) in below directory. i would like to get all table names from that all sas programs.&lt;BR /&gt;&lt;BR /&gt;/cloud/pvxxx-123/mktprf/89009321/code/&lt;BR /&gt;sample sas program name&lt;BR /&gt;/cloud/pvxxx-123/mktprf/89009321/code/ext_xpo_map.sas&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/441250"&gt;@soujik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best you can get is to actually execute the code and use Proc Scaproc to get some logging information that's then easy to parse for the information you're after.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Parsing actual SAS code to get this information is not only cumbersome but it will potentially also not return what you're after because there are many ways where table names get only determined during run time and they might differ between runs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider for example code as below:&lt;/P&gt;
&lt;PRE&gt;data demo;
  set mylib.monthly_tables_:;
run;&lt;/PRE&gt;
&lt;P&gt;Which tables you actually pick will depend on what's stored under mylib at the time your code executes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2024 05:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-table-name-in-sas-program-prod-sql/m-p/923269#M363509</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-04-06T05:30:36Z</dc:date>
    </item>
  </channel>
</rss>

