<?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: ng COlumn to Existing Data Table in a Macro STep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542814#M150012</link>
    <description>ballardw,&lt;BR /&gt;&lt;BR /&gt;THANK YOU! I really appreciate your help.&lt;BR /&gt;&lt;BR /&gt;Dave</description>
    <pubDate>Wed, 13 Mar 2019 14:47:08 GMT</pubDate>
    <dc:creator>dwilliams1</dc:creator>
    <dc:date>2019-03-13T14:47:08Z</dc:date>
    <item>
      <title>ng COlumn to Existing Data Table in a Macro STep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542803#M150008</link>
      <description>&lt;P&gt;I want to add a column to an existing data table in a macro step.&amp;nbsp;I've already connected to a database and extracted the files of interest.&amp;nbsp; The filename contains the specific lot ID&amp;nbsp;but it is no where in the data table itself. So, I want to create a new column that contains the lot designation.&amp;nbsp; In the snippet below, the sql portion works fine but the subsequent data step doesn't.&amp;nbsp;More specifically, the part that fails is passing the macro variable in the data steps.&amp;nbsp; Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;options&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;symbolgen&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;mprint&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;&lt;I&gt;loop&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%to&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;create table &amp;amp;&amp;amp;ParamList&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;i.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;data as&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;from Prod&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp;&amp;amp;ParamList&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;i.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;DATA;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;data &amp;amp;&amp;amp;ParamList&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;i.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;set &amp;amp;&amp;amp;ParamList&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;i.&lt;STRONG&gt;._&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Lot_ID=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%str&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(%'&amp;amp;&amp;amp;ParamList&amp;amp;i%');&amp;nbsp; /* Here's where the issue is */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;loop&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following works but it's comp[lately manual...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; xyz_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; xyz_data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;runs=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'xyz'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 14:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542803#M150008</guid>
      <dc:creator>dwilliams1</dc:creator>
      <dc:date>2019-03-13T14:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: ng COlumn to Existing Data Table in a Macro STep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542809#M150010</link>
      <description>&lt;P&gt;Here's an example of reading the current data set name and parsing a value from that. You should set length for the SETNAME variable for what you expect.&lt;/P&gt;
&lt;PRE&gt;data example;
   
   set sashelp.class indsname=dsn;
   setname = scan(dsn,2,'.');
run;&lt;/PRE&gt;
&lt;P&gt;and from multiple datasets when combining them. Not a particularly useful set but shows an example:&lt;/P&gt;
&lt;PRE&gt;data example;
   
   set sashelp.class sashelp.cars indsname=dsn;
   setname = scan(dsn,2,'.');
run;&lt;/PRE&gt;
&lt;P&gt;I&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 14:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542809#M150010</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-13T14:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: ng COlumn to Existing Data Table in a Macro STep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542814#M150012</link>
      <description>ballardw,&lt;BR /&gt;&lt;BR /&gt;THANK YOU! I really appreciate your help.&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Wed, 13 Mar 2019 14:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542814#M150012</guid>
      <dc:creator>dwilliams1</dc:creator>
      <dc:date>2019-03-13T14:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: ng COlumn to Existing Data Table in a Macro STep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542817#M150014</link>
      <description>Your response was quicker than me trying to edit my post to account for the sloppy cut/paste that I did!</description>
      <pubDate>Wed, 13 Mar 2019 14:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ng-COlumn-to-Existing-Data-Table-in-a-Macro-STep/m-p/542817#M150014</guid>
      <dc:creator>dwilliams1</dc:creator>
      <dc:date>2019-03-13T14:50:01Z</dc:date>
    </item>
  </channel>
</rss>

