<?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: %let in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/let/m-p/6112#M2450</link>
    <description>Hi:&lt;BR /&gt;
  This is not really an ODS or BASE SAS reporting procedure question (PRINT, REPORT, TABULATE).&lt;BR /&gt;
 &lt;BR /&gt;
  For help with SAS macro processing, there is no better reference than the SAS Macro Facility documentation. If you have a particular SAS Macro question, then you might find better and more timely help by contacting SAS Technical Support.&lt;BR /&gt;
&lt;BR /&gt;
  In general however, there is no "accessing of multiple datasets" done by the SAS Macro facility. The SAS Macro facility generates code. It acts like a big typewriter. &lt;BR /&gt;
&lt;BR /&gt;
  If you have this code that defines 2 macro variables:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let wombat = Twas brillig and the slithy toves;&lt;BR /&gt;
%let koala = Did gyre and gimble in the wabe;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
you are creating 2 macro variables, &amp;amp;WOMBAT and &amp;amp;KOALA that are just text strings. You can't do much with 2 snippets of a poem in a SAS program however, except make them variable values:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data jabberwocky;&lt;BR /&gt;
  line = "&amp;amp;wombat";&lt;BR /&gt;
  output;&lt;BR /&gt;
  line = "&amp;amp;koala";&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
proc print data=jabberwocky;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
However, if you had a %LET statement like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let mydata = sashelp.prdsale sashelp.prdsal2;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Then the macro variable &amp;amp;MYDATA is only holding the text string which is 2 file names -- the 2 files are not "accessed" by the macro facility.&lt;BR /&gt;
&lt;BR /&gt;
However, if you have a working SAS program:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data newfile;&lt;BR /&gt;
  set sashelp.prdsale sashelp.prdsal2;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
then you have a place in that working SAS program where you could USE the macro variable: &lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data newfile;&lt;BR /&gt;
  set &amp;amp;mydata;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Now, it is the DATA step program that is accessing the 2 data files. The macro variable is just a convenience or a shortcut that you use on the SET statement. Now you could write something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data Germany;&lt;BR /&gt;
  set &amp;amp;mydata;&lt;BR /&gt;
  if country = 'GERMANY' then do;&lt;BR /&gt;
      .... more code;&lt;BR /&gt;
  output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
       &lt;BR /&gt;
data USA;&lt;BR /&gt;
  set &amp;amp;mydata;&lt;BR /&gt;
  if country = 'USA' then do;&lt;BR /&gt;
    ... more code;&lt;BR /&gt;
  output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Of course, there are more efficient ways to create multiple datasets, however, the above example shows an instance where you might want to use the macro variable &amp;amp;MYDATA more than 1 time, in more than 1 program.&lt;BR /&gt;
&lt;BR /&gt;
To contact Tech Support, go to &lt;A href="http://support.sas.com" target="_blank"&gt;http://support.sas.com&lt;/A&gt; and on the left hand navigation area, look for the link, entitled "Submit a Problem" in order to send your question to Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Thu, 03 Jan 2008 17:28:04 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2008-01-03T17:28:04Z</dc:date>
    <item>
      <title>%let</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/let/m-p/6111#M2449</link>
      <description>Is there any possible to access multiple dataset by using %let&lt;BR /&gt;
dataset  names x,y,z.&lt;BR /&gt;
we can use SET statement similary in Macros</description>
      <pubDate>Thu, 03 Jan 2008 13:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/let/m-p/6111#M2449</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-01-03T13:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: %let</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/let/m-p/6112#M2450</link>
      <description>Hi:&lt;BR /&gt;
  This is not really an ODS or BASE SAS reporting procedure question (PRINT, REPORT, TABULATE).&lt;BR /&gt;
 &lt;BR /&gt;
  For help with SAS macro processing, there is no better reference than the SAS Macro Facility documentation. If you have a particular SAS Macro question, then you might find better and more timely help by contacting SAS Technical Support.&lt;BR /&gt;
&lt;BR /&gt;
  In general however, there is no "accessing of multiple datasets" done by the SAS Macro facility. The SAS Macro facility generates code. It acts like a big typewriter. &lt;BR /&gt;
&lt;BR /&gt;
  If you have this code that defines 2 macro variables:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let wombat = Twas brillig and the slithy toves;&lt;BR /&gt;
%let koala = Did gyre and gimble in the wabe;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
you are creating 2 macro variables, &amp;amp;WOMBAT and &amp;amp;KOALA that are just text strings. You can't do much with 2 snippets of a poem in a SAS program however, except make them variable values:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data jabberwocky;&lt;BR /&gt;
  line = "&amp;amp;wombat";&lt;BR /&gt;
  output;&lt;BR /&gt;
  line = "&amp;amp;koala";&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
proc print data=jabberwocky;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
However, if you had a %LET statement like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let mydata = sashelp.prdsale sashelp.prdsal2;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Then the macro variable &amp;amp;MYDATA is only holding the text string which is 2 file names -- the 2 files are not "accessed" by the macro facility.&lt;BR /&gt;
&lt;BR /&gt;
However, if you have a working SAS program:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data newfile;&lt;BR /&gt;
  set sashelp.prdsale sashelp.prdsal2;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
then you have a place in that working SAS program where you could USE the macro variable: &lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data newfile;&lt;BR /&gt;
  set &amp;amp;mydata;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Now, it is the DATA step program that is accessing the 2 data files. The macro variable is just a convenience or a shortcut that you use on the SET statement. Now you could write something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data Germany;&lt;BR /&gt;
  set &amp;amp;mydata;&lt;BR /&gt;
  if country = 'GERMANY' then do;&lt;BR /&gt;
      .... more code;&lt;BR /&gt;
  output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
       &lt;BR /&gt;
data USA;&lt;BR /&gt;
  set &amp;amp;mydata;&lt;BR /&gt;
  if country = 'USA' then do;&lt;BR /&gt;
    ... more code;&lt;BR /&gt;
  output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Of course, there are more efficient ways to create multiple datasets, however, the above example shows an instance where you might want to use the macro variable &amp;amp;MYDATA more than 1 time, in more than 1 program.&lt;BR /&gt;
&lt;BR /&gt;
To contact Tech Support, go to &lt;A href="http://support.sas.com" target="_blank"&gt;http://support.sas.com&lt;/A&gt; and on the left hand navigation area, look for the link, entitled "Submit a Problem" in order to send your question to Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 03 Jan 2008 17:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/let/m-p/6112#M2450</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-01-03T17:28:04Z</dc:date>
    </item>
  </channel>
</rss>

