<?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 Create a column with name of datasets you are stacking in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-with-name-of-datasets-you-are-stacking/m-p/833609#M329552</link>
    <description>&lt;P&gt;I know there's a way to do this but I cannot remember what the option is called and am also having trouble looking it up.&lt;/P&gt;
&lt;P&gt;I essentially want to stack multiple datasets and have a column created with their names in it so I can keep track of which data belongs to which dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
 var1 = 'A'; var2= 'BC'; var3= 1;
data have2;
 var1 = 'D'; var2= 'EF'; var3= 2;
data have;
 set have1 have2;
run;

data want;
 input dsn $ var1 $ var2 $ var3 @@;
 cards;
 have1 A BC 1
 have2 D EF 2
 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Sep 2022 14:30:52 GMT</pubDate>
    <dc:creator>mariko5797</dc:creator>
    <dc:date>2022-09-15T14:30:52Z</dc:date>
    <item>
      <title>Create a column with name of datasets you are stacking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-with-name-of-datasets-you-are-stacking/m-p/833609#M329552</link>
      <description>&lt;P&gt;I know there's a way to do this but I cannot remember what the option is called and am also having trouble looking it up.&lt;/P&gt;
&lt;P&gt;I essentially want to stack multiple datasets and have a column created with their names in it so I can keep track of which data belongs to which dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
 var1 = 'A'; var2= 'BC'; var3= 1;
data have2;
 var1 = 'D'; var2= 'EF'; var3= 2;
data have;
 set have1 have2;
run;

data want;
 input dsn $ var1 $ var2 $ var3 @@;
 cards;
 have1 A BC 1
 have2 D EF 2
 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Sep 2022 14:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-with-name-of-datasets-you-are-stacking/m-p/833609#M329552</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2022-09-15T14:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column with name of datasets you are stacking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-with-name-of-datasets-you-are-stacking/m-p/833615#M329556</link>
      <description>&lt;P&gt;&amp;nbsp;Use the INDSNAME (&lt;STRONG&gt;In&lt;/STRONG&gt;put &lt;STRONG&gt;D&lt;/STRONG&gt;ata&lt;STRONG&gt;S&lt;/STRONG&gt;et &lt;STRONG&gt;N&lt;/STRONG&gt;a&lt;STRONG&gt;m&lt;/STRONG&gt;e) option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
    length source src $40.;
    set have1 have2 indsname = source;
    src=source;
run;
&lt;/PRE&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>Thu, 15 Sep 2022 14:51:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-with-name-of-datasets-you-are-stacking/m-p/833615#M329556</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-09-15T14:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column with name of datasets you are stacking</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-with-name-of-datasets-you-are-stacking/m-p/833622#M329558</link>
      <description>&lt;P&gt;Check out&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2015/08/03/indsname-option.html" target="_self"&gt;Where did it come from? Adding the source of each observation to a SAS data set&lt;/A&gt;&amp;nbsp;by Rick Wicklin.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 15:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-with-name-of-datasets-you-are-stacking/m-p/833622#M329558</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-15T15:00:38Z</dc:date>
    </item>
  </channel>
</rss>

