<?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 22-322: Syntax error in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622719#M19835</link>
    <description>&lt;P&gt;Take care of proper naming of variables in the data step, and of macro timing. The data step needs to RUN to populate the macro variables, so you must not use %put IN the data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today=%sysfunc(today());
%let currdt=%sysfunc(datetime());

data _null_;
date2=intnx("month",&amp;amp;today.,-1,'end');
put date2=;
call symputx('DATE2',put(date2 ,date9.));
month_id = intck('month','01jan1990'd,today());
put month_id=;
call symputx('month_id',month_id);
run;

%put &amp;amp;=date2;
%put &amp;amp;=month_id;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Feb 2020 14:32:23 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-02-06T14:32:23Z</dc:date>
    <item>
      <title>ERROR 22-322: Syntax error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622713#M19832</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling to fix this bit of code . Could someone help me please ?&lt;/P&gt;&lt;P&gt;Many thanks in advance.&lt;/P&gt;&lt;PRE&gt;%let today=%sysfunc(today());
%let currdt=%sysfunc(datetime());
data _null_;

date2=intnx("month",&amp;amp;today.,-1,'end');
put date2=;
call symputx('DATE2',put(&amp;amp;date2. ,date9.));
%put DATE2=&amp;amp;date2.;

month_id = intck('month','01jan1990'd,today());
put month_id=;
call symputx('month_id',month_id);
%put month_id=&amp;amp;month_id.;

run;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LOG FILE:

23         GOPTIONS ACCESSIBLE;
24         
25         
26         %let today=%sysfunc(today());
27         %let currdt=%sysfunc(datetime());
28         data _null_;
29         
30         date2=intnx("month",&amp;amp;today.,-1,'end');
31         put date2=;
32         call symputx('DATE2',put(&amp;amp;date2. ,date9.));
NOTE: Line generated by the macro variable "DATE2".
32         31JAN2020
             _______
             22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, 
              LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.  

33         %put DATE2=&amp;amp;date2.;
DATE2=31JAN2020
34         
35         month_id = intck('month','01jan1990'd,today());
36         put month_id=;
37         call symputx('month_id',month_id);
38         %put month_id=&amp;amp;month_id.;
month_id=361
39         
40         run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622713#M19832</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2020-02-06T14:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622714#M19833</link>
      <description>&lt;P&gt;date2 is not a macro variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today=%sysfunc(today());
%let currdt=%sysfunc(datetime());
data _null_;

date2=intnx("month",&amp;amp;today.,-1,'end');
put date2=;
call symputx('DATE2',put(date2 ,date9.));
%put DATE2=&amp;amp;date2.;

month_id = intck('month','01jan1990'd,today());
put month_id=;
call symputx('month_id',month_id);

put month_id=&amp;amp;month_id.;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622714#M19833</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-06T14:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622719#M19835</link>
      <description>&lt;P&gt;Take care of proper naming of variables in the data step, and of macro timing. The data step needs to RUN to populate the macro variables, so you must not use %put IN the data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today=%sysfunc(today());
%let currdt=%sysfunc(datetime());

data _null_;
date2=intnx("month",&amp;amp;today.,-1,'end');
put date2=;
call symputx('DATE2',put(date2 ,date9.));
month_id = intck('month','01jan1990'd,today());
put month_id=;
call symputx('month_id',month_id);
run;

%put &amp;amp;=date2;
%put &amp;amp;=month_id;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622719#M19835</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-06T14:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622721#M19836</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270435"&gt;@jorquec&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today=%sysfunc(today());
%let currdt=%sysfunc(datetime());
%let date= %sysfunc(intnx(month,&amp;amp;today., -1,e),date9.);
%let month_id= %sysfunc(intck(month,'01jan1990'd,&amp;amp;today.));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-22-322-Syntax-error/m-p/622721#M19836</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-06T14:43:29Z</dc:date>
    </item>
  </channel>
</rss>

