<?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: Error with parameter when used to assign a tbl name (used during create tbl in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-with-parameter-when-used-to-assign-a-tbl-name-used-during/m-p/74660#M16077</link>
    <description>Reply again with a complete SAS log, using the additional OPTIONS statement, which may help self-diagnose the error:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MPRINT;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Fri, 09 Apr 2010 17:59:37 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-04-09T17:59:37Z</dc:date>
    <item>
      <title>Error with parameter when used to assign a tbl name (used during create tbl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-with-parameter-when-used-to-assign-a-tbl-name-used-during/m-p/74659#M16076</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
For some reason the symput variable I'm using won't work with a table name I'm creating. Is there any way around this?&lt;BR /&gt;
&lt;BR /&gt;
ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: (, AS, LIKE.  &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
libname t '/sas/userdata/mine';&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
tod_date = date();&lt;BR /&gt;
call symput('todaydate', tod_date);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table t.rec_m_list&amp;amp;todaydate as&lt;BR /&gt;
select * from t.data_table;&lt;BR /&gt;
quit;</description>
      <pubDate>Fri, 09 Apr 2010 17:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-with-parameter-when-used-to-assign-a-tbl-name-used-during/m-p/74659#M16076</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-09T17:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error with parameter when used to assign a tbl name (used during create tbl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-with-parameter-when-used-to-assign-a-tbl-name-used-during/m-p/74660#M16077</link>
      <description>Reply again with a complete SAS log, using the additional OPTIONS statement, which may help self-diagnose the error:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MPRINT;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 09 Apr 2010 17:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-with-parameter-when-used-to-assign-a-tbl-name-used-during/m-p/74660#M16077</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-04-09T17:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Error with parameter when used to assign a tbl name (used during create tbl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-with-parameter-when-used-to-assign-a-tbl-name-used-during/m-p/74661#M16078</link>
      <description>&amp;gt; Hello,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; For some reason the symput variable I'm using won't&lt;BR /&gt;
&amp;gt; work with a table name I'm creating. Is there any way&lt;BR /&gt;
&amp;gt; around this?&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ERROR 202-322: The option or parameter is not&lt;BR /&gt;
&amp;gt; recognized and will be ignored.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ERROR 22-322: Syntax error, expecting one of the&lt;BR /&gt;
&amp;gt; following: (, AS, LIKE.  &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; libname t '/sas/userdata/mine';&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; data _null_;&lt;BR /&gt;
&amp;gt; tod_date = date();&lt;BR /&gt;
&amp;gt; call symput('todaydate', tod_date);&lt;BR /&gt;
&amp;gt; run;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; proc sql;&lt;BR /&gt;
&amp;gt; create table t.rec_m_list&amp;amp;todaydate as&lt;BR /&gt;
&amp;gt; select * from t.data_table;&lt;BR /&gt;
&amp;gt; quit;&lt;BR /&gt;
&lt;BR /&gt;
ScottP1&lt;BR /&gt;
it is obvious (once you know 15 answers - obvious millionaire time &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; too )&lt;BR /&gt;
So remember that macro variables are strings, so&lt;BR /&gt;
&amp;gt; call symput('todaydate', tod_date);&lt;BR /&gt;
converts the value in tod_date to a string with default conversion.&lt;BR /&gt;
Better in SAS9 is symputX() which suppresses the NOTE about numeric to character conversion and removes leading and trailing blanks from the value pushed into the macro variable 'todaydate'.&lt;BR /&gt;
Your problem was probably caused by leading blanks in the value in &amp;amp;todaydate.&lt;BR /&gt;
 &lt;BR /&gt;
Another issue might strike you once you solve that leading blank problem. &lt;BR /&gt;
The value is just a number, because sas supports dates by storing them as a number and providing a wealth of formats to present dates.&lt;BR /&gt;
So, table t.rec_m_list&amp;amp;todaydate would become something like t.rec_m_list18362 on 10-Apr-2010.&lt;BR /&gt;
If you wanted t.rec_m_list20100410, you could use&lt;BR /&gt;
&amp;gt;&amp;gt; call symput('todaydate', put(tod_date, yymmddN8.) );&lt;BR /&gt;
That put() function creates a date string just 8 digits wide, so no blanks.&lt;BR /&gt;
 &lt;BR /&gt;
but I wouldn't use nor recommend a datastep for this kind of thing.&lt;BR /&gt;
Are you ready for %sysfunc() ? Check it out in on the sas support web site. Here is my take on achieving what you seem to seek&lt;BR /&gt;
 &lt;BR /&gt;
%let todayDate = %sysfunc( date(), yymmddN8 );&lt;BR /&gt;
&amp;gt; proc sql;&lt;BR /&gt;
&amp;gt; create table t.rec_m_list&amp;amp;todaydate as&lt;BR /&gt;
&amp;gt; select * from t.data_table;&lt;BR /&gt;
&amp;gt; quit;&lt;BR /&gt;
Alternative formats have inconveniences like not sorting well when a list of these tables is sorted by name, or containing invalid characters like /&lt;BR /&gt;
 &lt;BR /&gt;
have a look at call symputX() and %sysfunc(). Not only do I think you'll find it informative. I think you'll come up with even better ways to use these features.&lt;BR /&gt;
 &lt;BR /&gt;
Look forward to hearing more from you ScottP1, demonstrating new found learning.&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Sat, 10 Apr 2010 03:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-with-parameter-when-used-to-assign-a-tbl-name-used-during/m-p/74661#M16078</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-04-10T03:29:15Z</dc:date>
    </item>
  </channel>
</rss>

