<?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: ODS Excelxp filename using macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ODS-Excelxp-filename-using-macro-variables/m-p/23805#M3964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I am guessing that you are trying to create the macro variables parmSite and parmSubj from the values of siteid and subjid. You are getting the errors because siteid and subjid are NOT macro variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the data step you are looking for:&lt;/P&gt;&lt;P&gt; call symput(parmsite,siteid);&lt;/P&gt;&lt;P&gt; call symput(parmsubj,subjid);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then your fpath assignment may work. Depending on length assignments and values you may want to use strip to remove unwanted blanks such as &lt;/P&gt;&lt;P&gt;call symput(parmsite,strip(siteid)); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you get unwanted spaces in the resolved value for fpath.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jan 2012 16:58:13 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2012-01-04T16:58:13Z</dc:date>
    <item>
      <title>ODS Excelxp filename using macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Excelxp-filename-using-macro-variables/m-p/23803#M3962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;I am trying to create an ODS destination file for the excel tagset using macro variables. The files contain data by site and patient, so would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;Data_12_001.xls&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;Data_12_002.xls&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;Etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;The siteid and subjid are in the file &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;sitepatientlist.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;I have the following code, which is not working:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt;data _null_;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt;do obsnum=1 to last by 1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set outlib.&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;sitepatientlist&lt;/SPAN&gt; point=obsnum nobs=last;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt;%let parmSite = &amp;amp;siteid;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt;%let parmSubj = &amp;amp;subjid;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt;%let fpath = "U:\outputs\data_&amp;amp;parmSite.._&amp;amp;parmSubj..xls";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12pt; background-color: white; font-family: 'Arial','sans-serif';"&gt;ODS TAGSETS.EXCELXP file=&amp;amp;fpath;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;…etc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;I get an unresolved reference for parmSite and parmSubj. I can see that they populate correctly in the %let statements, but the fpath does not resolve.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;I have tried many variations - anybody have any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Arial','sans-serif'; background-color: white;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 15:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Excelxp-filename-using-macro-variables/m-p/23803#M3962</guid>
      <dc:creator>LSchafer</dc:creator>
      <dc:date>2012-01-04T15:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: ODS Excelxp filename using macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Excelxp-filename-using-macro-variables/m-p/23804#M3963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While you didn't show all of your code, it appears that you are trying to both assign and use a macro variable within the same datastep.&amp;nbsp; That won't work as the macro variable can only be accessed after that datastep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some alternatives are suggested in the following paper: &lt;A href="http://www2.sas.com/proceedings/sugi31/115-31.pdf"&gt;http://www2.sas.com/proceedings/sugi31/115-31.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 15:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Excelxp-filename-using-macro-variables/m-p/23804#M3963</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-04T15:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: ODS Excelxp filename using macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Excelxp-filename-using-macro-variables/m-p/23805#M3964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I am guessing that you are trying to create the macro variables parmSite and parmSubj from the values of siteid and subjid. You are getting the errors because siteid and subjid are NOT macro variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the data step you are looking for:&lt;/P&gt;&lt;P&gt; call symput(parmsite,siteid);&lt;/P&gt;&lt;P&gt; call symput(parmsubj,subjid);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then your fpath assignment may work. Depending on length assignments and values you may want to use strip to remove unwanted blanks such as &lt;/P&gt;&lt;P&gt;call symput(parmsite,strip(siteid)); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you get unwanted spaces in the resolved value for fpath.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Excelxp-filename-using-macro-variables/m-p/23805#M3964</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-01-04T16:58:13Z</dc:date>
    </item>
  </channel>
</rss>

