<?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: using a macro variable in a name literal in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101637#M21277</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your SAS explorer or open the excel sheet, get the sheet name you need. I suspect that you don't have a sheet name called p123data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Aug 2013 20:24:08 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2013-08-05T20:24:08Z</dc:date>
    <item>
      <title>using a macro variable in a name literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101636#M21276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im trying to use a macro variable in a name literal to reference an excel sheet but it is not working for me. i can get the libname statement to work but not the data step. is there anyway to evaluate a macro variable inside the name literal? here is my code and error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let prot=132;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname stabdata "C:\Desktop\p&amp;amp;prot..xlsx";&lt;/P&gt;&lt;P&gt;data p&amp;amp;prot.data; set stabdata.'p&amp;amp;prot.data$'n; run;&lt;/P&gt;&lt;P&gt;libname stabdata clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would like the data step to evaluate as &lt;SPAN style="color: #339966;"&gt;&lt;STRONG&gt;data p132data; set stabdata.'p132data$'n; run;&lt;/STRONG&gt; &lt;SPAN style="color: #000000;"&gt;but i get the following error&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;data p&amp;amp;prot.data; set stabdata.'p&amp;amp;prot.data$'n; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;ERROR: File STABDATA.'p&amp;amp;prot.data$'n.DATA does not exist.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 20:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101636#M21276</guid>
      <dc:creator>spirto</dc:creator>
      <dc:date>2013-08-05T20:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: using a macro variable in a name literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101637#M21277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your SAS explorer or open the excel sheet, get the sheet name you need. I suspect that you don't have a sheet name called p123data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 20:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101637#M21277</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-08-05T20:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: using a macro variable in a name literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101638#M21278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haikuo-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i checked SAS explorer and the excel sheet is listed. I believe the problem is that the macro variable is not being resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if i manually change the &lt;SPAN style="color: #339966;"&gt;&lt;STRONG&gt;stabdata.'p&amp;amp;prot.data$'n&lt;/STRONG&gt;&lt;/SPAN&gt; to &lt;SPAN style="color: #339966;"&gt;&lt;STRONG&gt;stabdata.'p132data$'n &lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;then everything works ok&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 20:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101638#M21278</guid>
      <dc:creator>spirto</dc:creator>
      <dc:date>2013-08-05T20:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: using a macro variable in a name literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101639#M21279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macro variables do not expand within single quotes. Convert to using double quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366; font-family: 'courier new', courier; background-color: #ffffff; font-size: 12pt;"&gt;stabdata."p&amp;amp;prot.data$"n;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 21:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101639#M21279</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-08-05T21:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: using a macro variable in a name literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101640#M21280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent!! I didn't know that SAS literals worked with double quotes...I was always under the impression that name, time, date, etc literals needed single quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 21:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macro-variable-in-a-name-literal/m-p/101640#M21280</guid>
      <dc:creator>spirto</dc:creator>
      <dc:date>2013-08-05T21:26:13Z</dc:date>
    </item>
  </channel>
</rss>

