<?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: Identify Table Name in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30827#M7338</link>
    <description>What if you create your macro variable with (in =  ) options built in.  You may still need create a string to keep those values as in = vars are dropped at the end of the data step.&lt;BR /&gt;
&lt;BR /&gt;
select  name || '(in = ' || name ||')' separated by  ' ' into :</description>
    <pubDate>Tue, 15 Dec 2009 14:44:22 GMT</pubDate>
    <dc:creator>Flip</dc:creator>
    <dc:date>2009-12-15T14:44:22Z</dc:date>
    <item>
      <title>Identify Table Name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30823#M7334</link>
      <description>Hi All:&lt;BR /&gt;
&lt;BR /&gt;
This is more programming than procedure oriented ...&lt;BR /&gt;
&lt;BR /&gt;
I build a list of table names using a PROC SQL using the INTO.  &lt;BR /&gt;
&lt;BR /&gt;
I then use this macro variable to read a set of tables into one:&lt;BR /&gt;
&lt;BR /&gt;
   DATA ACTIVITY:&lt;BR /&gt;
   SET &amp;amp;members;&lt;BR /&gt;
&lt;BR /&gt;
   etc.&lt;BR /&gt;
&lt;BR /&gt;
It could process up to 127 "members" into the single table.  &lt;BR /&gt;
&lt;BR /&gt;
My question is: can I add a variable to  ACTIVITY that identifies which table in the list of &amp;amp;members each observation came from?   &lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Tue, 15 Dec 2009 14:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30823#M7334</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2009-12-15T14:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Table Name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30824#M7335</link>
      <description>Add a RETAIN statement that resolves a SAS variable in your DATA step.  In the statement, declare the macro variable in double-quotes as the variable value.  Add an ATTRIB statement to document the variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 15 Dec 2009 14:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30824#M7335</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-15T14:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Table Name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30825#M7336</link>
      <description>Scott:&lt;BR /&gt;
&lt;BR /&gt;
That won't work - the &amp;amp;members macro variable contains up to 127 table names that are basically being concatenated.&lt;BR /&gt;
&lt;BR /&gt;
I need to know which one contributed each observation.</description>
      <pubDate>Tue, 15 Dec 2009 14:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30825#M7336</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2009-12-15T14:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Table Name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30826#M7337</link>
      <description>Okay, then use the IN= parameter on the SET statement, and assign a concatenated string of subfield values (how about one char per input file), and use the "1" or "0" indicator from the IN= to detect when one of your input files (to the SET) is contributing an observation.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 15 Dec 2009 14:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30826#M7337</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-15T14:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Table Name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30827#M7338</link>
      <description>What if you create your macro variable with (in =  ) options built in.  You may still need create a string to keep those values as in = vars are dropped at the end of the data step.&lt;BR /&gt;
&lt;BR /&gt;
select  name || '(in = ' || name ||')' separated by  ' ' into :</description>
      <pubDate>Tue, 15 Dec 2009 14:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30827#M7338</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-12-15T14:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Table Name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30828#M7339</link>
      <description>There is a SET statement option for this in V9.2  if you have less than 9.1.3 like me you can do something like....&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data one two three four five;&lt;BR /&gt;
   x = 1;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   select cats(memname,'(in=__',memname,')') into :codeGen separated by ' '&lt;BR /&gt;
   from dictionary.members where libname eq 'WORK';&lt;BR /&gt;
   quit;&lt;BR /&gt;
   run;&lt;BR /&gt;
%put NOTE: CODEGEN=&amp;amp;codegen;&lt;BR /&gt;
data all;&lt;BR /&gt;
   set &amp;amp;codegen;&lt;BR /&gt;
   array _&lt;LI&gt; __:;&lt;BR /&gt;
   length origin $32;&lt;BR /&gt;
   origin = substr(vname(_[whichn(1,of _&lt;/LI&gt;&lt;LI&gt;)]),3);&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]&lt;/LI&gt;</description>
      <pubDate>Tue, 15 Dec 2009 15:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30828#M7339</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-12-15T15:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Table Name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30829#M7340</link>
      <description>as pointed out by data _null_, there is an option in SAS92. The topic is covered already at &lt;A href="http://support.sas.com/forums/thread.jspa?threadID=8013" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?threadID=8013&lt;/A&gt; , pointing to Usage note on option INDSNAME= {VARname} see &lt;A href="http://support.sas.com/kb/34/513.html" target="_blank"&gt;http://support.sas.com/kb/34/513.html&lt;/A&gt; . I managed this back in 2001, before INdsname= was available, with the techniques referred by earlier posters. My solution can be found on SAS-L at &lt;BR /&gt;
&lt;A href="http://listserv.uga.edu/cgi-bin/wa?A2=ind0111A&amp;amp;L=sas-l&amp;amp;P=22975" target="_blank"&gt;http://listserv.uga.edu/cgi-bin/wa?A2=ind0111A&amp;amp;L=sas-l&amp;amp;P=22975&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Peter.C to refer to sas-L, 2001

fixing broken link 21/2/10. Message was edited by: Peter.C</description>
      <pubDate>Wed, 16 Dec 2009 12:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-Table-Name/m-p/30829#M7340</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-12-16T12:59:34Z</dc:date>
    </item>
  </channel>
</rss>

