<?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: Macro to create new variable based on dataset name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29472#M5551</link>
    <description>Hi:&lt;BR /&gt;
  You could "macro-ize" something like the program example below. It is always best, however to start with a basic non-macro program and understand how it works before you convert it to a macro program.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
 [pre]&lt;BR /&gt;
data new;&lt;BR /&gt;
  set sashelp.prdsale(in=prdsale)&lt;BR /&gt;
      sashelp.prdsal2(in=prdsal2)&lt;BR /&gt;
      sashelp.prdsal3(in=prdsal3);&lt;BR /&gt;
  if prdsale=1 then filename = 'SASHELP.PRDSALE';&lt;BR /&gt;
  else if prdsal2 = 1 then filename = 'SASHELP.PRDSAL2';&lt;BR /&gt;
  else if prdsal3 = 1 then filename = 'SASHELP.PRDSAL3';&lt;BR /&gt;
run;&lt;BR /&gt;
                                                             &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc freq data=new order=data;&lt;BR /&gt;
  tables filename;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Fri, 11 Dec 2009 22:13:54 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2009-12-11T22:13:54Z</dc:date>
    <item>
      <title>Macro to create new variable based on dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29471#M5550</link>
      <description>Have 51 separate county datasets.  Want to combine the 51 county datasets and create a variable "county name" based on the name of each dataset.  Any suggestions?</description>
      <pubDate>Fri, 11 Dec 2009 22:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29471#M5550</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-11T22:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create new variable based on dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29472#M5551</link>
      <description>Hi:&lt;BR /&gt;
  You could "macro-ize" something like the program example below. It is always best, however to start with a basic non-macro program and understand how it works before you convert it to a macro program.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
 [pre]&lt;BR /&gt;
data new;&lt;BR /&gt;
  set sashelp.prdsale(in=prdsale)&lt;BR /&gt;
      sashelp.prdsal2(in=prdsal2)&lt;BR /&gt;
      sashelp.prdsal3(in=prdsal3);&lt;BR /&gt;
  if prdsale=1 then filename = 'SASHELP.PRDSALE';&lt;BR /&gt;
  else if prdsal2 = 1 then filename = 'SASHELP.PRDSAL2';&lt;BR /&gt;
  else if prdsal3 = 1 then filename = 'SASHELP.PRDSAL3';&lt;BR /&gt;
run;&lt;BR /&gt;
                                                             &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc freq data=new order=data;&lt;BR /&gt;
  tables filename;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 11 Dec 2009 22:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29472#M5551</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-12-11T22:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create new variable based on dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29473#M5552</link>
      <description>if you have SAS92 use 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; .</description>
      <pubDate>Fri, 11 Dec 2009 22:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29473#M5552</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-12-11T22:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create new variable based on dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29474#M5553</link>
      <description>Thanks, Peter! I forget sometimes to point out the newer syntax. &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 11 Dec 2009 22:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-create-new-variable-based-on-dataset-name/m-p/29474#M5553</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-12-11T22:27:25Z</dc:date>
    </item>
  </channel>
</rss>

