<?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: A name token was expected in SAS Viya</title>
    <link>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956855#M2731</link>
    <description>&lt;P&gt;"&lt;SPAN&gt;NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you can't find the problem in the code, try to strip down the macro until it works, and than add code part by part until you find the problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2025 07:38:44 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2025-01-22T07:38:44Z</dc:date>
    <item>
      <title>ERROR: A name token was expected</title>
      <link>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956803#M2728</link>
      <description>&lt;P&gt;I have this macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro run_cas_ma;&lt;BR /&gt;libname _tmpcas_ cas caslib="CASUSER";&lt;/P&gt;
&lt;P&gt;proc cas;&lt;BR /&gt;/* Ensure that the session is set correctly */&lt;BR /&gt;session %sysfunc(getlsessref(&amp;amp;dataset_lib));&lt;BR /&gt;&lt;BR /&gt;/* Load the necessary action set */&lt;BR /&gt;loadactionset %sysfunc(quote(timeData));&lt;BR /&gt;&lt;BR /&gt;action runTimeCode /&lt;BR /&gt;table={&lt;BR /&gt;caslib=%sysfunc(quote(%sysfunc(getlcaslib(&amp;amp;dataset_lib))))%str(,)&lt;BR /&gt;name=%sysfunc(quote(&amp;amp;dataset_name))&lt;BR /&gt;} /* Table definition comes first */&lt;BR /&gt;&lt;BR /&gt;objOut={&lt;BR /&gt;{&lt;BR /&gt;table={&lt;BR /&gt;caslib=%sysfunc(quote(%sysfunc(getlcaslib(_tmpcas_))))%str(,)&lt;BR /&gt;name=%qsysfunc(quote(outStatTemp)) %str(,)&lt;BR /&gt;replace=%sysfunc(quote(true))&lt;BR /&gt;}%str(,)&lt;BR /&gt;objRef=%str('outStat')&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;/* Conditionally add forecast output if plotForecastViya is set to 1 */&lt;BR /&gt;%if &amp;amp;plotForecastViya = 1 %then %do;&lt;BR /&gt;%str(,)&lt;BR /&gt;{&lt;BR /&gt;table={&lt;BR /&gt;caslib=%sysfunc(quote(%sysfunc(getlcaslib(_tmpcas_))))%str(,)&lt;BR /&gt;name=%sysfunc(quote(outFcastTemp)) %str(,)&lt;BR /&gt;replace=%sysfunc(quote(true))&lt;BR /&gt;}%str(,)&lt;BR /&gt;objRef=%str('outFcast')&lt;BR /&gt;}&lt;BR /&gt;%end;&lt;/P&gt;
&lt;P&gt;seasonality=12&lt;BR /&gt;timeId={name=%str('date') %str(,) FORMAT=%sysfunc(quote(_DATA_))}&lt;BR /&gt;interval="Month"&lt;BR /&gt;nlFormat=true&lt;BR /&gt;series={'sale'}&lt;BR /&gt;require={{pkg='TSM'}}&lt;BR /&gt;code=%str(%')&lt;BR /&gt;declare object myModel(TSM);&lt;BR /&gt;declare object mySpec(ARIMASpec);&lt;BR /&gt;rc = mySpec.Open();&lt;BR /&gt;&lt;BR /&gt;/* Loop to assign values to ma[&amp;amp;i.] */&lt;BR /&gt;%do i=1 %to &amp;amp;map.; &lt;BR /&gt;ma[&amp;amp;i.] = &amp;amp;i.;&lt;BR /&gt;%end;&lt;BR /&gt;rc = mySpec.AddMAPoly(ma);&lt;BR /&gt;rc = mySpec.SetOption("noint",1);&lt;BR /&gt;rc = mySpec.SetOption("method","CLS");&lt;BR /&gt;rc = mySpec.close();&lt;BR /&gt;&lt;BR /&gt;/* Initialize the model */&lt;BR /&gt;rc = myModel.Initialize(mySpec);&lt;BR /&gt;rc = myModel.SetY(&amp;amp;dependVariable);&lt;BR /&gt;rc = myModel.SetOption('lead', &amp;amp;forecastPeriods);&lt;BR /&gt;rc = myModel.SetOption("alpha",0.05);&lt;BR /&gt;rc = myModel.Run();&lt;BR /&gt;&lt;BR /&gt;/* Collect forecast if plotForecastViya is set to 1 */&lt;BR /&gt;%if &amp;amp;plotForecastViya = 1 %then %do;&lt;BR /&gt;declare object outFcast(TSMFor);&lt;BR /&gt;rc = outFcast.Collect(myModel);&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;declare object outStat(TSMSTAT);&lt;BR /&gt;rc = outStat.Collect(myModel);&lt;BR /&gt;%str(%');&lt;BR /&gt;run;&lt;BR /&gt;%mend run_cas_ma;&lt;/P&gt;
&lt;P&gt;%run_cas_ma&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This i giving me error&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MPRINT(__CODE): action runTimeCode / table={ caslib="CASUSER(swkuma)", name="PRICEDATA" } objOut={ { table={ caslib="CASUSER", &lt;BR /&gt;name="outStatTemp" , replace="true" }, objRef='outStat' } } , { table={ caslib="CASUSER", name="outFcastTemp" , replace="true" }, &lt;BR /&gt;objRef='outFcast' } seasonality=12 timeId={name='date' , FORMAT="_DATA_"} interval="Month" nlFormat=true series={'sale'} &lt;BR /&gt;require={{pkg='TSM'}} code=' declare object myModel(TSM); declare object mySpec(ARIMASpec); rc = &lt;BR /&gt;mySpec.Open(); ma[1] = 1; rc = mySpec.AddMAPoly(ma); rc = mySpec.SetOption("noint",1); &lt;BR /&gt;rc = mySpec.SetOption("method","CLS"); rc = mySpec.close(); rc = &lt;BR /&gt;myModel.Initialize(mySpec); rc = myModel.SetY(sale); rc = myModel.SetOption('lead', 12); rc = &lt;BR /&gt;myModel.SetOption("alpha",0.05); rc = myModel.Run(); declare object outFcast(TSMFor); rc = &lt;BR /&gt;outFcast.Collect(myModel); declare object outStat(TSMSTAT); rc = outStat.Collect(myModel); &lt;BR /&gt;';&lt;BR /&gt;ERROR: A name token was expected&lt;BR /&gt;ERROR: action runTimeCode / table = { caslib = 'CASUSER(swkuma)' , n&lt;BR /&gt;ERROR: ame = 'PRICEDATA' } objOut = { { table = { caslib = 'CASUSER'&lt;BR /&gt;ERROR: , name = 'outStatTemp' , replace = 'true' } , objRef = 'outS&lt;BR /&gt;ERROR: tat' } } , { table = { caslib = 'CASUSER' , name = 'outFcastT&lt;BR /&gt;ERROR: emp' , replace = 'true' } , objRef = 'outFcast' } seasonality&lt;BR /&gt;ERROR: = 12 timeId = { name = 'date' , FORMAT = '_DATA_' } interval&lt;BR /&gt;ERROR: = 'Month' nlFormat = TRUE series = { 'sale' } require = { { &lt;BR /&gt;ERROR: pkg = 'TSM' } } code = ' declare object myModel(TS&lt;BR /&gt;ERROR: M); declare object mySpec(ARIMASpec); r&lt;BR /&gt;ERROR: c = mySpec.Open(); ma[1] = 1; rc = &lt;BR /&gt;ERROR: mySpec.AddMAPoly(ma); rc = mySpec.SetOption("noint&lt;BR /&gt;ERROR: ",1); rc = mySpec.SetOption("method","CLS"); &lt;BR /&gt;ERROR: rc = mySpec.close(); &lt;BR /&gt;ERROR: rc = myModel.Initialize(mySpec); rc = myModel.Set&lt;BR /&gt;ERROR: Y(sale); rc = myModel.SetOption(' lead ', 12); &lt;BR /&gt;ERROR: rc = myModel.SetOption("alpha",0.05); rc =&lt;BR /&gt;ERROR: myModel.Run(); declare object outFcast(TSMFor)&lt;BR /&gt;ERROR: ; rc = outFcast.Collect(myModel); &lt;BR /&gt;ERROR: declare object outStat(TSMSTAT); rc = ou&lt;BR /&gt;ERROR: tStat.Collect(myModel); ' ;&lt;BR /&gt;ERROR: ^&lt;BR /&gt;NOTE: The submitted statements have been canceled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me to debug why this is coming and how to resolve this . Thanks!!&lt;/P&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;&amp;nbsp;&lt;/P&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;</description>
      <pubDate>Tue, 21 Jan 2025 21:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956803#M2728</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2025-01-21T21:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A name token was expected</title>
      <link>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956807#M2729</link>
      <description>&lt;P&gt;Use this little icon :&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_0-1737495268177.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103886i1339FEB17143B106/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_0-1737495268177.png" alt="yabwon_0-1737495268177.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;to paste your code like it should be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro run_cas_ma;
libname _tmpcas_ cas caslib="CASUSER";

proc cas;
/* Ensure that the session is set correctly */
session %sysfunc(getlsessref(&amp;amp;dataset_lib));

/* Load the necessary action set */
loadactionset %sysfunc(quote(timeData));

action runTimeCode /
table={
caslib=%sysfunc(quote(%sysfunc(getlcaslib(&amp;amp;dataset_lib))))%str(,)
name=%sysfunc(quote(&amp;amp;dataset_name))
} /* Table definition comes first */

objOut={
{
table={
caslib=%sysfunc(quote(%sysfunc(getlcaslib(_tmpcas_))))%str(,)
name=%qsysfunc(quote(outStatTemp)) %str(,)
replace=%sysfunc(quote(true))
}%str(,)
objRef=%str('outStat')
}
}

/* Conditionally add forecast output if plotForecastViya is set to 1 */
%if &amp;amp;plotForecastViya = 1 %then %do;
%str(,)
{
table={
caslib=%sysfunc(quote(%sysfunc(getlcaslib(_tmpcas_))))%str(,)
name=%sysfunc(quote(outFcastTemp)) %str(,)
replace=%sysfunc(quote(true))
}%str(,)
objRef=%str('outFcast')
}
%end;

seasonality=12
timeId={name=%str('date') %str(,) FORMAT=%sysfunc(quote(_DATA_))}
interval="Month"
nlFormat=true
series={'sale'}
require={{pkg='TSM'}}
code=%str(%')
declare object myModel(TSM);
declare object mySpec(ARIMASpec);
rc = mySpec.Open();

/* Loop to assign values to ma[&amp;amp;i.] */
%do i=1 %to &amp;amp;map.;
ma[&amp;amp;i.] = &amp;amp;i.;
%end;
rc = mySpec.AddMAPoly(ma);
rc = mySpec.SetOption("noint",1);
rc = mySpec.SetOption("method","CLS");
rc = mySpec.close();

/* Initialize the model */
rc = myModel.Initialize(mySpec);
rc = myModel.SetY(&amp;amp;dependVariable);
rc = myModel.SetOption('lead', &amp;amp;forecastPeriods);
rc = myModel.SetOption("alpha",0.05);
rc = myModel.Run();

/* Collect forecast if plotForecastViya is set to 1 */
%if &amp;amp;plotForecastViya = 1 %then %do;
declare object outFcast(TSMFor);
rc = outFcast.Collect(myModel);
%end;

declare object outStat(TSMSTAT);
rc = outStat.Collect(myModel);
%str(%');
run;
%mend run_cas_ma;

%run_cas_ma&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;First of all: writing a macro without parameters is &lt;EM&gt;bad programming practice&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second thing what are:&lt;/P&gt;
&lt;P&gt;timeData,&amp;nbsp;outFcastTemp are those mcarovariables ? or constant texts ?&lt;/P&gt;
&lt;P&gt;Where the&amp;nbsp;&amp;amp;map. macrovariabel comes from?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where is the definition of array "ma", that one used here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do i=1 %to &amp;amp;map.;
ma[&amp;amp;i.] = &amp;amp;i.;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;Mprint in the text you pasted comes from macro:&amp;nbsp;&lt;SPAN&gt;__CODE, where is that macro defined?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Assigning TRUE/FALSE values to option:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;replace=%sysfunc(quote(true))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I think should be like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;replace=1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;or&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;replace=True&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;(see example: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/caspg/p1668p6hhivls3n11q05kk6h1zgj.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/caspg/p1668p6hhivls3n11q05kk6h1zgj.htm&lt;/A&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Single-quotes embedded improperly in "code":&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_0-1737496198498.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103887iEBF8C72E96B37316/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_0-1737496198498.png" alt="yabwon_0-1737496198498.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Etc., etc., etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 21:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956807#M2729</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-01-21T21:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A name token was expected</title>
      <link>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956837#M2730</link>
      <description>Thanks for checking. Here is the MPRINT&lt;BR /&gt;MPRINT(__CODE):   proc cas;&lt;BR /&gt;MPRINT(__CODE):   session CASAUTO;&lt;BR /&gt;MPRINT(__CODE):   loadactionset "timeData";&lt;BR /&gt;NOTE: The quoted string currently being processed has become more than 262 bytes long.  You might have unbalanced quotation marks.&lt;BR /&gt;NOTE: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space between a &lt;BR /&gt;      quoted string and the succeeding identifier is recommended.&lt;BR /&gt;MPRINT(__CODE):   action runTimeCode / table={ caslib="CASUSER(swkuma)", name="PRICEDATA" } objOut={ { table={ caslib="CASUSER", &lt;BR /&gt;name="outStatTemp" , replace="true" }, objRef='outStat' } } seasonality=12 timeId={name='date' , FORMAT="_DATA_"} interval="Month" &lt;BR /&gt;nlFormat=true series={'sale'} require={{pkg='TSM'}} code='            declare object myModel(TSM);            declare object &lt;BR /&gt;mySpec(ARIMASpec);            rc = mySpec.Open();            array ma[2]/nosymbols;                ma[1] = 1;                ma[2] &lt;BR /&gt;= 2;            rc = mySpec.AddMAPoly(ma);            rc = mySpec.SetOption("noint",1);            rc = &lt;BR /&gt;mySpec.SetOption("method","CLS");            rc = mySpec.close();                                    rc = &lt;BR /&gt;myModel.Initialize(mySpec);            rc = myModel.SetY(sale);            rc = myModel.SetOption('lead', 12);            rc = &lt;BR /&gt;myModel.SetOption("alpha",0.05);            rc = myModel.Run();                        declare object outStat(TSMSTAT);            &lt;BR /&gt;rc = outStat.Collect(myModel);        ';&lt;BR /&gt;ERROR: A name token was expected&lt;BR /&gt;ERROR: action runTimeCode / table = { caslib = 'CASUSER(swkuma)' , n&lt;BR /&gt;ERROR: ame = 'PRICEDATA' } objOut = { { table = { caslib = 'CASUSER'&lt;BR /&gt;ERROR:  , name = 'outStatTemp' , replace = 'true' } , objRef = 'outS&lt;BR /&gt;ERROR: tat' } } seasonality = 12 timeId = { name = 'date' , FORMAT =&lt;BR /&gt;ERROR:  '_DATA_' } interval = 'Month' nlFormat = TRUE series = { 'sa&lt;BR /&gt;ERROR: le' } require = { { pkg = 'TSM' } } code = '            decla&lt;BR /&gt;ERROR: re object myModel(TSM);            declare object mySpec(ARIM&lt;BR /&gt;ERROR: ASpec);            rc = mySpec.Open();            array ma[2]&lt;BR /&gt;ERROR: /nosymbols;                ma[1] = 1;                ma[2] = &lt;BR /&gt;ERROR: 2;            rc = mySpec.AddMAPoly(ma);            rc = mySp&lt;BR /&gt;ERROR: ec.SetOption("noint",1);            rc = mySpec.SetOption("me&lt;BR /&gt;ERROR: thod","CLS");            rc = mySpec.close();                &lt;BR /&gt;ERROR:                     rc = myModel.Initialize(mySpec);         &lt;BR /&gt;ERROR:    rc = myModel.SetY(sale);            rc = myModel.SetOption&lt;BR /&gt;ERROR: (' lead ', 12);            rc = myModel.SetOption("alpha",0.0&lt;BR /&gt;ERROR: 5);            rc = myModel.Run();                        dec&lt;BR /&gt;ERROR: lare object outStat(TSMSTAT);            rc = outStat.Collect&lt;BR /&gt;ERROR: (myModel);        ' ;&lt;BR /&gt;ERROR:                    ^&lt;BR /&gt;NOTE: The submitted statements have been canceled.&lt;BR /&gt;MPRINT(__CODE):   run;&lt;BR /&gt;MPRINT(__CODE):  ;&lt;BR /&gt;NOTE: PROCEDURE CAS used (Total process time):&lt;BR /&gt;      real time           0.00 seconds&lt;BR /&gt;      cpu time            0.00 seconds</description>
      <pubDate>Wed, 22 Jan 2025 04:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956837#M2730</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2025-01-22T04:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A name token was expected</title>
      <link>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956855#M2731</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you can't find the problem in the code, try to strip down the macro until it works, and than add code part by part until you find the problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 07:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/ERROR-A-name-token-was-expected/m-p/956855#M2731</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-01-22T07:38:44Z</dc:date>
    </item>
  </channel>
</rss>

