<?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 Can I include the dataset name in a query (proc sql or data step) without hardcoding it in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-I-include-the-dataset-name-in-a-query-proc-sql-or-data-step/m-p/716282#M221341</link>
    <description>&lt;P&gt;Suppose I have two datasets named ds1, ds2 that have each 4 columns (their structure is the same):&lt;/P&gt;&lt;P&gt;ds1:&lt;/P&gt;&lt;P&gt;col1 |&amp;nbsp;col2 |&amp;nbsp;col3 |&amp;nbsp;col4&lt;/P&gt;&lt;P&gt;================&lt;/P&gt;&lt;P&gt;122 | aaa | a1a1 | b1b1&lt;/P&gt;&lt;P&gt;124 | a1a | a2&amp;nbsp; &amp;nbsp; | b2bb&lt;/P&gt;&lt;P&gt;235 | aaa |&amp;nbsp; e34 | r45&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ds2:&lt;/P&gt;&lt;P&gt;col1 |&amp;nbsp;col2 |&amp;nbsp;col3 |&amp;nbsp;col4&lt;/P&gt;&lt;P&gt;================&lt;/P&gt;&lt;P&gt;224 | baa | a2a1 | b1b2&lt;/P&gt;&lt;P&gt;124 | a1a | a2&amp;nbsp; &amp;nbsp; | b2bb&lt;/P&gt;&lt;P&gt;547 | aaa |&amp;nbsp; e54 | v45&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write some code that will create a&amp;nbsp; dataset containing col1 and col2 and a new column that would contain the dataset name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The condition would be col2='aaa'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the new dataset would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;col1 |&amp;nbsp;col2 | name&lt;/P&gt;&lt;P&gt;=============&lt;/P&gt;&lt;P&gt;122 | aaa | ds1&lt;/P&gt;&lt;P&gt;235 | aaa |&amp;nbsp;ds1&lt;/P&gt;&lt;P&gt;547 | aaa |&amp;nbsp;ds2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wouldn't want to hardcode the name of the datasets in the new query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion would be greatly apprecited.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Feb 2021 01:36:16 GMT</pubDate>
    <dc:creator>DritanB</dc:creator>
    <dc:date>2021-02-03T01:36:16Z</dc:date>
    <item>
      <title>Can I include the dataset name in a query (proc sql or data step) without hardcoding it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-include-the-dataset-name-in-a-query-proc-sql-or-data-step/m-p/716282#M221341</link>
      <description>&lt;P&gt;Suppose I have two datasets named ds1, ds2 that have each 4 columns (their structure is the same):&lt;/P&gt;&lt;P&gt;ds1:&lt;/P&gt;&lt;P&gt;col1 |&amp;nbsp;col2 |&amp;nbsp;col3 |&amp;nbsp;col4&lt;/P&gt;&lt;P&gt;================&lt;/P&gt;&lt;P&gt;122 | aaa | a1a1 | b1b1&lt;/P&gt;&lt;P&gt;124 | a1a | a2&amp;nbsp; &amp;nbsp; | b2bb&lt;/P&gt;&lt;P&gt;235 | aaa |&amp;nbsp; e34 | r45&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ds2:&lt;/P&gt;&lt;P&gt;col1 |&amp;nbsp;col2 |&amp;nbsp;col3 |&amp;nbsp;col4&lt;/P&gt;&lt;P&gt;================&lt;/P&gt;&lt;P&gt;224 | baa | a2a1 | b1b2&lt;/P&gt;&lt;P&gt;124 | a1a | a2&amp;nbsp; &amp;nbsp; | b2bb&lt;/P&gt;&lt;P&gt;547 | aaa |&amp;nbsp; e54 | v45&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write some code that will create a&amp;nbsp; dataset containing col1 and col2 and a new column that would contain the dataset name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The condition would be col2='aaa'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the new dataset would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;col1 |&amp;nbsp;col2 | name&lt;/P&gt;&lt;P&gt;=============&lt;/P&gt;&lt;P&gt;122 | aaa | ds1&lt;/P&gt;&lt;P&gt;235 | aaa |&amp;nbsp;ds1&lt;/P&gt;&lt;P&gt;547 | aaa |&amp;nbsp;ds2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wouldn't want to hardcode the name of the datasets in the new query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion would be greatly apprecited.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 01:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-include-the-dataset-name-in-a-query-proc-sql-or-data-step/m-p/716282#M221341</guid>
      <dc:creator>DritanB</dc:creator>
      <dc:date>2021-02-03T01:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can I include the dataset name in a query (proc sql or data step) without hardcoding it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-include-the-dataset-name-in-a-query-proc-sql-or-data-step/m-p/716284#M221343</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set DS1 DS2 indsname=INDS;
  where COL2='aaa';
  NAME=INDS;
  keep COL1 COL2 NAME;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 01:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-include-the-dataset-name-in-a-query-proc-sql-or-data-step/m-p/716284#M221343</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-03T01:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can I include the dataset name in a query (proc sql or data step) without hardcoding it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-include-the-dataset-name-in-a-query-proc-sql-or-data-step/m-p/716286#M221344</link>
      <description>Thank you!</description>
      <pubDate>Wed, 03 Feb 2021 02:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-include-the-dataset-name-in-a-query-proc-sql-or-data-step/m-p/716286#M221344</guid>
      <dc:creator>DritanB</dc:creator>
      <dc:date>2021-02-03T02:06:43Z</dc:date>
    </item>
  </channel>
</rss>

