<?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: Parameter values as macro variables in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22294#M3508</link>
    <description>Hi:&lt;BR /&gt;
  Like Scott, I think it's possible that your error may be coming from some other location in your code. There are a few different ways to use a compound name to reference a particular column in a SELECT clause. The program below creates some test data and any of the methods work for me. I don't get any errors in the SAS log.&lt;BR /&gt;
 &lt;BR /&gt;
  cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let macro = 090313;&lt;BR /&gt;
%put -----&amp;gt; resolves to: MYDATA_AREA_&amp;amp;macro;&lt;BR /&gt;
                               &lt;BR /&gt;
ods listing;&lt;BR /&gt;
data work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
  id = put(_n_,2.0);&lt;BR /&gt;
run;&lt;BR /&gt;
                                         &lt;BR /&gt;
proc print data=work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
  title "work.mydata_area_&amp;amp;macro";&lt;BR /&gt;
run;&lt;BR /&gt;
                        &lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE WORK.CUSTOMERS_NEW_ACCOUNT AS &lt;BR /&gt;
   SELECT MYDATA_AREA_&amp;amp;macro..ID FORMAT=$8.,&lt;BR /&gt;
          MYDATA_AREA_&amp;amp;macro..NAME,&lt;BR /&gt;
          MYDATA_AREA_&amp;amp;macro..AGE&lt;BR /&gt;
   FROM work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
quit;&lt;BR /&gt;
                              &lt;BR /&gt;
proc print data=work.customers_new_account;&lt;BR /&gt;
  title 'after sql';&lt;BR /&gt;
run;&lt;BR /&gt;
                    &lt;BR /&gt;
** Alternate methods of referencing variables in PROC SQL;&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE WORK.ALT1 AS &lt;BR /&gt;
   SELECT ID FORMAT=$8.,&lt;BR /&gt;
          NAME,&lt;BR /&gt;
          AGE&lt;BR /&gt;
   FROM work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
quit;&lt;BR /&gt;
                     &lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE WORK.ALT2 AS &lt;BR /&gt;
   SELECT AAA.ID FORMAT=$8.,&lt;BR /&gt;
          AAA.NAME,&lt;BR /&gt;
          AAA.AGE&lt;BR /&gt;
   FROM work.mydata_area_&amp;amp;macro as AAA;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
    <pubDate>Wed, 22 Apr 2009 19:43:30 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2009-04-22T19:43:30Z</dc:date>
    <item>
      <title>Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22290#M3504</link>
      <description>I'm trying to use some parameter values in code as macro variables. The values themselves are numbers but input as a string to show a date ie: 090313&lt;BR /&gt;
&lt;BR /&gt;
This value is then needed to be used as part of a dataset name :&lt;BR /&gt;
&lt;BR /&gt;
MYDATA_AREA_&amp;amp;MACRO..NAME FORMAT=$8&lt;BR /&gt;
&lt;BR /&gt;
now the parameter value I'm inputting is being shown in the log OK but when the above code is reached it doesn't recognise the macro and I get the following:&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;
Does anyone have any ideas how to get this to work.  The reason I'm using the parameters is so the user has a nice input box to use</description>
      <pubDate>Wed, 22 Apr 2009 17:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22290#M3504</guid>
      <dc:creator>Ted</dc:creator>
      <dc:date>2009-04-22T17:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22291#M3505</link>
      <description>Hi:&lt;BR /&gt;
  I'm having a brain freeze trying to imagine how a dataset name is used with a FORMAT= option (possibly a PROC TABULATE statement?? but then I would expect the format to be a numeric format, not a character format):&lt;BR /&gt;
[pre]&lt;BR /&gt;
You show:&lt;BR /&gt;
MYDATA_AREA_&amp;amp;MACRO..NAME format=$8&lt;BR /&gt;
Which resolves to:&lt;BR /&gt;
MYDATA_AREA_090313.NAME format=$8&lt;BR /&gt;
   &lt;BR /&gt;
Might expect:&lt;BR /&gt;
  proc tabulate data=MYDATA_AREA_&amp;amp;MACRO..NAME format=8.;&lt;BR /&gt;
Resolves to:&lt;BR /&gt;
  proc tabulate data=MYDATA_AREA_090313.NAME format=8.;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                       &lt;BR /&gt;
  Having a bit more code, such as a COMPLETE statement with the macro variable reference (or a bit of the SAS log error), might be aid debugging.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 22 Apr 2009 17:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22291#M3505</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-04-22T17:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22292#M3506</link>
      <description>This is taken from a Proc SQL statement I've had to change names etc due to the nature of the data.  What you say it should resolve to is correct but it doesn't.  This line is followed by about 20 more bringing in various variables and formatting them.  I get the same error for everyone.&lt;BR /&gt;
&lt;BR /&gt;
 PROC SQL;&lt;BR /&gt;
         CREATE TABLE WORK.CUSTOMERS_NEW_ACCOUNT AS SELECT MYYDATA_AREA_&amp;amp;MACRO..ID FORMAT=$8.,&lt;BR /&gt;
                                                                                                                                                                                                                     ____&lt;BR /&gt;
                                                                                              202&lt;BR /&gt;
&lt;BR /&gt;
the 202 code is shown below the variable name.&lt;BR /&gt;
&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: a quoted string, !, !!, &amp;amp;, (, *, **, +, ',', -, '.', /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &lt;BR /&gt;
              &amp;gt;, &amp;gt;=, ?, AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT, INTO, IS, LABEL, LE, &lt;BR /&gt;
              LEN, LENGTH, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, TRANSCODE, ^, ^=, |, ||, ~, ~=.</description>
      <pubDate>Wed, 22 Apr 2009 18:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22292#M3506</guid>
      <dc:creator>Ted</dc:creator>
      <dc:date>2009-04-22T18:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22293#M3507</link>
      <description>Suggest you explain your SAS log diagnostics perspective by adding the following line:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MPRINT;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Then don't always focus on the exact line that's raising the error condition - but also be cognizant of any comments and incorrectly (syntax) structured SAS code just prior to the error point.&lt;BR /&gt;
&lt;BR /&gt;
Yours is typical - though without seeing the code just before the PROC SQL statement, it's a guess.  Check for a SAS comment that is not terminated correctly, with a trailing asterisk.  If that's not it, add the OPTIONS and rerun.  Then if you can't figure it out, paste the more complete SAS Log, and include the SAS-generate logic that occurs just before the error message.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 22 Apr 2009 18:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22293#M3507</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-22T18:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22294#M3508</link>
      <description>Hi:&lt;BR /&gt;
  Like Scott, I think it's possible that your error may be coming from some other location in your code. There are a few different ways to use a compound name to reference a particular column in a SELECT clause. The program below creates some test data and any of the methods work for me. I don't get any errors in the SAS log.&lt;BR /&gt;
 &lt;BR /&gt;
  cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let macro = 090313;&lt;BR /&gt;
%put -----&amp;gt; resolves to: MYDATA_AREA_&amp;amp;macro;&lt;BR /&gt;
                               &lt;BR /&gt;
ods listing;&lt;BR /&gt;
data work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
  id = put(_n_,2.0);&lt;BR /&gt;
run;&lt;BR /&gt;
                                         &lt;BR /&gt;
proc print data=work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
  title "work.mydata_area_&amp;amp;macro";&lt;BR /&gt;
run;&lt;BR /&gt;
                        &lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE WORK.CUSTOMERS_NEW_ACCOUNT AS &lt;BR /&gt;
   SELECT MYDATA_AREA_&amp;amp;macro..ID FORMAT=$8.,&lt;BR /&gt;
          MYDATA_AREA_&amp;amp;macro..NAME,&lt;BR /&gt;
          MYDATA_AREA_&amp;amp;macro..AGE&lt;BR /&gt;
   FROM work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
quit;&lt;BR /&gt;
                              &lt;BR /&gt;
proc print data=work.customers_new_account;&lt;BR /&gt;
  title 'after sql';&lt;BR /&gt;
run;&lt;BR /&gt;
                    &lt;BR /&gt;
** Alternate methods of referencing variables in PROC SQL;&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE WORK.ALT1 AS &lt;BR /&gt;
   SELECT ID FORMAT=$8.,&lt;BR /&gt;
          NAME,&lt;BR /&gt;
          AGE&lt;BR /&gt;
   FROM work.mydata_area_&amp;amp;macro;&lt;BR /&gt;
quit;&lt;BR /&gt;
                     &lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE WORK.ALT2 AS &lt;BR /&gt;
   SELECT AAA.ID FORMAT=$8.,&lt;BR /&gt;
          AAA.NAME,&lt;BR /&gt;
          AAA.AGE&lt;BR /&gt;
   FROM work.mydata_area_&amp;amp;macro as AAA;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 22 Apr 2009 19:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22294#M3508</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-04-22T19:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22295#M3509</link>
      <description>OK so here's the actual log.  The first part is pretty usual EG generated code. &lt;BR /&gt;
&lt;BR /&gt;
    ;*';*";*/;quit;run;&lt;BR /&gt;
2          OPTIONS PAGENO=MIN;&lt;BR /&gt;
3          %LET _CLIENTTASKLABEL=%NRBQUOTE(Lib and intial Code);&lt;BR /&gt;
4          %LET _EGTASKLABEL=%NRBQUOTE(Lib and intial Code);&lt;BR /&gt;
5          %LET _CLIENTPROJECTNAME=%NRBQUOTE(\\Dfz70162\199682030\workgroup\DMS99\42633-Auto Check PC New Claims\Live&lt;BR /&gt;
5        ! SAS\Development Folder\AutoCheck_NEWACC_LiveV3Chop.egp);&lt;BR /&gt;
6          %LET _SASPROGRAMFILE=;&lt;BR /&gt;
7          %LET DLAC_DATE = %STR(090222);&lt;BR /&gt;
8          %LET ICAC_DATE = %STR(090305);&lt;BR /&gt;
9          %LET IICSC_DATE = %STR(090305);&lt;BR /&gt;
10         %LET PCC_DATE = %STR(090313);&lt;BR /&gt;
11         %LET PCC_MINUS1_DATE = %STR(090306);&lt;BR /&gt;
12         %LET PCNC_DATE = %STR(090313);&lt;BR /&gt;
13         %LET PSCSC_DATE = %STR(090305);&lt;BR /&gt;
14         &lt;BR /&gt;
15         ODS _ALL_ CLOSE;&lt;BR /&gt;
NOTE: Some of your options or statements may not be supported with the Activex or Java series of devices.  Graph defaults for these &lt;BR /&gt;
      drivers may be different from other SAS/GRAPH device drivers.  For further information, please contact Technical Support.&lt;BR /&gt;
16         OPTIONS DEV=ACTIVEX;&lt;BR /&gt;
17         FILENAME EGHTML TEMP;&lt;BR /&gt;
NOTE: Writing HTML(EGHTML) Body file: EGHTML&lt;BR /&gt;
18         ODS HTML(ID=EGHTML) FILE=EGHTML ENCODING='utf-8' STYLE=EGDefault&lt;BR /&gt;
18       ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/Enterprise%20Guide%204/BIClientStyles/EGDefault.css")&lt;BR /&gt;
18       ! ATTRIBUTES=("CODEBASE"="http://www2.sas.com/codebase/graph/v91/sasgraph.exe") NOGTITLE NOGFOOTNOTE GPATH=&amp;amp;sasworklocation&lt;BR /&gt;
18       ! ;&lt;BR /&gt;
19         &lt;BR /&gt;
20         %gaccessible;&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
64          CREATE TABLE WORK.PMC_CUSTOMERS_NEW_ACC AS SELECT PRIMARYDATA_NAMES_&amp;amp;PCC_DATE..IDNO FORMAT=$8.,&lt;BR /&gt;
                                                                                              ____&lt;BR /&gt;
                                                                                              202&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I ran with the option and got the following&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
35         PROC SQL;&lt;BR /&gt;
36          CREATE TABLE WORK.PMC_CUSTOMERS_NEW_CLAIMS AS SELECT PRIMARYDATA_NAMES_&amp;amp;PCC_DATE..IDNO FORMAT=$8.,&lt;BR /&gt;
SYMBOLGEN:  Macro variable PCC_DATE resolves to 090313&lt;BR /&gt;
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;
36          CREATE TABLE WORK.PMC_CUSTOMERS_NEW_ACC AS SELECT PRIMARYDATA_NAMES_&amp;amp;PCC_DATE..IDNO FORMAT=$8.,&lt;BR /&gt;
                                                                                              ____&lt;BR /&gt;
                                                                                              202&lt;BR /&gt;
ERROR 202-322: The option or parameter is not recognized and will be ignored.</description>
      <pubDate>Wed, 22 Apr 2009 19:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22295#M3509</guid>
      <dc:creator>Ted</dc:creator>
      <dc:date>2009-04-22T19:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22296#M3510</link>
      <description>Unfortunately, blanks do not render well in pasted text, but if you notice your macro variable &amp;amp;PCC_DATE and what follows.&lt;BR /&gt;
&lt;BR /&gt;
You have too many periods for your SAS variable name, I would submit - a period is not allowed:&lt;BR /&gt;
&lt;BR /&gt;
PRIMARYDATA_NAMES_&amp;amp;PCC_DATE..IDNO&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 22 Apr 2009 20:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22296#M3510</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-22T20:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22297#M3511</link>
      <description>I have all the periods in the right places.  The only thing I can put it down to at the moment is the way the macro variable is used by EG from the intial input form.&lt;BR /&gt;
&lt;BR /&gt;
By coding in the macro value without the use of the parameter form everything works fine.&lt;BR /&gt;
&lt;BR /&gt;
Cynthia, I ran your code and it works fine but if I change the 'macro' to an EG parameter and then input its value via the parameter input screen I then get the same error I am experiencing with my own code.

Message was edited by: Ted</description>
      <pubDate>Thu, 23 Apr 2009 09:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22297#M3511</guid>
      <dc:creator>Ted</dc:creator>
      <dc:date>2009-04-23T09:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter values as macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22298#M3512</link>
      <description>It looks like I have finally solved the problem.&lt;BR /&gt;
&lt;BR /&gt;
By using the %UNQUOTE macro on all the macro variables being created from the EG Parameter input form the code now works perfectly&lt;BR /&gt;
&lt;BR /&gt;
%let PCC_DATE1 = %unquote(&amp;amp;PCC_DATE);&lt;BR /&gt;
&lt;BR /&gt;
I guess this is a &lt;I&gt;'Feature'&lt;/I&gt; of EG : )&lt;BR /&gt;
&lt;BR /&gt;
Thanks Cynthia and Scott for trying to help out.</description>
      <pubDate>Thu, 23 Apr 2009 11:19:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Parameter-values-as-macro-variables/m-p/22298#M3512</guid>
      <dc:creator>Ted</dc:creator>
      <dc:date>2009-04-23T11:19:25Z</dc:date>
    </item>
  </channel>
</rss>

