<?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: Changing Dataset Names using SAS Macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295521#M61770</link>
    <description>&lt;P&gt;Look closely at&amp;nbsp;of proc import datafile="&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New"&gt;C:\Users\cafarrel\Desktop\&lt;/FONT&gt;&lt;FONT color="#ff0000"&gt;\&lt;/FONT&gt;&lt;/STRONG&gt;REPORTING_DATA.sav"&lt;/P&gt;
&lt;P&gt;2 slashes in the file name, and since one looks different when I paste it, the second may not be the character it looked like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not that it causes the error but this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
%LET reportingdt = %str(June2016);
RUN;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Only needs to be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token macroname"&gt;%LET&lt;/SPAN&gt; reportingdt &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token macrostatement"&gt;%str&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;June2016&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;It will help to post log extracts with errors using the entry box brough up by the "run" icon to preserve formating so we can see&lt;/P&gt;
&lt;P&gt;where the underlines are generated.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2016 14:33:00 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-08-31T14:33:00Z</dc:date>
    <item>
      <title>Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295514#M61765</link>
      <description>&lt;P&gt;I'm fairly new to this Macro things and I would like to have a dataset be named according to a parameter that is set using a "macro"-type paremeter -&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
%LET reportingdt = %str(June2016);
RUN;

proc import datafile="C:\Users\cafarrel\Desktop\\REPORTING_DATA.sav"
out=farrsas.reporting_&amp;amp;reportingdt dbms = sav replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;whenever I run this I get the following error message:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;26 proc import datafile="&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New"&gt;C:\Users\cafarrel\Desktop\&lt;/FONT&gt;&lt;/STRONG&gt;\REPORTING_DATA.sav"&lt;/P&gt;&lt;P&gt;27 out=farrsas.reporting_&amp;amp;reportingdt. dbms = sav replace;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro variable "REPORTINGDT".&lt;/P&gt;&lt;P&gt;27 farrsas.reporting_June2016&lt;/P&gt;&lt;P&gt;________&lt;/P&gt;&lt;P&gt;22&lt;/P&gt;&lt;P&gt;________&lt;/P&gt;&lt;P&gt;202&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, (, DATAFILE, DATATABLE, DBMS, DEBUG, FILE, OUT, REPLACE, TABLE,&lt;/P&gt;&lt;P&gt;_DEBUG_.&lt;/P&gt;&lt;P&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;28 run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am i doing wrong? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 14:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295514#M61765</guid>
      <dc:creator>camfarrell25</dc:creator>
      <dc:date>2016-08-31T14:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295521#M61770</link>
      <description>&lt;P&gt;Look closely at&amp;nbsp;of proc import datafile="&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New"&gt;C:\Users\cafarrel\Desktop\&lt;/FONT&gt;&lt;FONT color="#ff0000"&gt;\&lt;/FONT&gt;&lt;/STRONG&gt;REPORTING_DATA.sav"&lt;/P&gt;
&lt;P&gt;2 slashes in the file name, and since one looks different when I paste it, the second may not be the character it looked like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not that it causes the error but this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
%LET reportingdt = %str(June2016);
RUN;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Only needs to be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token macroname"&gt;%LET&lt;/SPAN&gt; reportingdt &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token macrostatement"&gt;%str&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;June2016&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;It will help to post log extracts with errors using the entry box brough up by the "run" icon to preserve formating so we can see&lt;/P&gt;
&lt;P&gt;where the underlines are generated.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 14:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295521#M61770</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-31T14:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295522#M61771</link>
      <description>&lt;P&gt;A likely culprit:&amp;nbsp; quoting functions such as %STR insert unseen quoting characters.&amp;nbsp; Usually SAS manages to remove them in time, but perhaps that is not happening here.&amp;nbsp; Try it this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let reportingdt = Jun2016;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc import .........; (no changes required)&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 14:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295522#M61771</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-31T14:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Dataset Names using SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295523#M61772</link>
      <description>&lt;P&gt;try setting the macro variable (first three lines of your program) as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let &amp;lt;macro_variable_name&amp;gt; = &amp;lt;macro_variable_argument&amp;gt; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The datastep data _null_ is ok but irrelevant (%let can be used in open code).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The %str() function seems to be the problem: I ran it without that and the code worked.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 14:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-Dataset-Names-using-SAS-Macros/m-p/295523#M61772</guid>
      <dc:creator>DocSteve</dc:creator>
      <dc:date>2016-08-31T14:35:03Z</dc:date>
    </item>
  </channel>
</rss>

