<?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: &amp;amp; in file name in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/amp-in-file-name-in-data-step/m-p/730097#M227298</link>
    <description>&lt;P&gt;So you ran this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Year = 2018 ;
%let oldendyr=%eval(&amp;amp;Year-1);
%let oldstartyr=%eval(&amp;amp;Year-10);
%let newstartyr=%eval(&amp;amp;Year-9);
data indicators&amp;amp;newstartyr_&amp;amp;Year;
  set sasout.indicators&amp;amp;oldstartyr_&amp;amp;oldendyr indicators&amp;amp;Year;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If so you are referencing two macro variables named NEWSTARTYR_ and OLDSTARTYR_ that you never defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You must use a period to let the macro processor know where the macro variable name ends when you have appended some other characters that could be part of the name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data indicators&amp;amp;newstartyr._&amp;amp;Year;
  set sasout.indicators&amp;amp;oldstartyr._&amp;amp;oldendyr indicators&amp;amp;Year;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 14:03:38 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-03-30T14:03:38Z</dc:date>
    <item>
      <title>&amp; in file name in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-in-file-name-in-data-step/m-p/730090#M227295</link>
      <description>&lt;P&gt;I hope this is an easy question for sasperts.&lt;/P&gt;
&lt;P&gt;I am updating the previous 10 year trend data with new data, to make a new 10 year trend data set.&lt;/P&gt;
&lt;P&gt;old data set is&amp;nbsp;indicators2008_2017&lt;/P&gt;
&lt;P&gt;adding in data for 2018, so for the new 10 year trend data set, i want the data set to be&amp;nbsp;indicators2009_2018&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this right?&lt;/P&gt;
&lt;P&gt;**** edit Year ******************** ;&lt;BR /&gt;%let Year = 2018 ;&lt;BR /&gt;/* these two lines are to identify the previous 10 year data set, that ends with the year -before- "year" and begins with year - 10. &lt;BR /&gt;For example, when updating with 2018 data, the previous data set was indicators2008_2017 */&lt;BR /&gt;%let oldendyr=%eval(&amp;amp;Year-1);&lt;BR /&gt;%let oldstartyr=%eval(&amp;amp;Year-10);&lt;/P&gt;
&lt;P&gt;* AND need the first year of the new 10 year data set, which would be year -9 ;&lt;BR /&gt;%let newstartyr=%eval(&amp;amp;Year-9);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then next, I'm trying to bring together the data for the current year with the data with the previous data set. I know this isn't right because I get errors.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data indicators&amp;amp;newstartyr_&amp;amp;Year;&lt;BR /&gt;set sasout.indicators&amp;amp;oldstartyr_&amp;amp;oldendyr&lt;BR /&gt;indicators&amp;amp;Year;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some output&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;2836 data indicators&amp;amp;newstartyr_&amp;amp;Year;&lt;/P&gt;
&lt;P&gt;(next three lines below under the &amp;amp; symbol)&lt;/P&gt;
&lt;P&gt;-&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, /, ;,&lt;BR /&gt;_DATA_, _LAST_, _NULL_.&lt;/P&gt;
&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 13:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-in-file-name-in-data-step/m-p/730090#M227295</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-30T13:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: &amp; in file name in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-in-file-name-in-data-step/m-p/730097#M227298</link>
      <description>&lt;P&gt;So you ran this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Year = 2018 ;
%let oldendyr=%eval(&amp;amp;Year-1);
%let oldstartyr=%eval(&amp;amp;Year-10);
%let newstartyr=%eval(&amp;amp;Year-9);
data indicators&amp;amp;newstartyr_&amp;amp;Year;
  set sasout.indicators&amp;amp;oldstartyr_&amp;amp;oldendyr indicators&amp;amp;Year;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If so you are referencing two macro variables named NEWSTARTYR_ and OLDSTARTYR_ that you never defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You must use a period to let the macro processor know where the macro variable name ends when you have appended some other characters that could be part of the name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data indicators&amp;amp;newstartyr._&amp;amp;Year;
  set sasout.indicators&amp;amp;oldstartyr._&amp;amp;oldendyr indicators&amp;amp;Year;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 14:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-in-file-name-in-data-step/m-p/730097#M227298</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-30T14:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: &amp; in file name in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-in-file-name-in-data-step/m-p/730103#M227303</link>
      <description>Thanks!</description>
      <pubDate>Tue, 30 Mar 2021 14:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-in-file-name-in-data-step/m-p/730103#M227303</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-30T14:27:55Z</dc:date>
    </item>
  </channel>
</rss>

