<?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, expecting one of the following: a quoted string, a numeric constant, in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941457#M369350</link>
    <description>&lt;P&gt;I think the code looks ok up to the point you stopped.&amp;nbsp; After that should be either an semicolon to define a subsetting if statement (probably not something you would do in the middle of a DO loop) or the THEN keyword to continue defining the IF statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise you might have introduced some invisible character, or perhaps one of those quotes is not actually a quote but is instead a typesetting "stupid" quote.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2024 15:00:30 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-08-28T15:00:30Z</dc:date>
    <item>
      <title>ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941442#M369342</link>
      <description>&lt;P&gt;Hello, I'm trying to run this code, and I am getting an error message, what do I need to do to in line 38 to get this to get it to work?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;Data temp (drop=z);&lt;/DIV&gt;&lt;DIV&gt;set work.complete22;&lt;/DIV&gt;&lt;DIV&gt;array DXS[18] $ dx1-dx18;&lt;/DIV&gt;&lt;DIV&gt;CO_FLAG = 0;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;do z= 1 to 18;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;if substr(DXS {z},1,5) IN:('T5801' 'T5804' 'T5811' 'T5814' 'T5891' 'T5894' 'T5802’ ‘T5803’ ‘T5812’ ‘T5813’)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;            or substr(DXS {z},1,6)IN:(‘T582X2’ ‘T582X3’ ‘T588X3’ ‘T5892' 'T582X1' 'T582X4' 'T588X1' 'T588X4')&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;or DXS{z} in: (‘T5882X2’)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;            then CO_FLAG = 1;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;            leave;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;            END;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;            run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; or substr(DXS {z},1,6)IN:(‘T582X2’ ‘T582X3’ ‘T588X3’ ‘T5892' 'T582X1' 'T582X4'&lt;/DIV&gt;&lt;DIV&gt;36 ! 'T588X1' 'T588X4')&lt;/DIV&gt;&lt;DIV&gt;37&lt;/DIV&gt;&lt;DIV&gt;38 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;or DXS{z} in: (‘T5882X2’)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;22&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;76&lt;/DIV&gt;&lt;DIV&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a datetime constant, a missing value, iterator, (.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 28 Aug 2024 14:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941442#M369342</guid>
      <dc:creator>Fadams12</dc:creator>
      <dc:date>2024-08-28T14:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941446#M369344</link>
      <description>&lt;P&gt;Please provide the entire procedure or data step log. Sometimes the place that SAS shows the error is because of something missing on a line much earlier. Also, please copy the text from the LOG, on the forum open a text window using the &amp;lt;/&amp;gt; icon that appears above the message window and paste the text there. The forum software reformats text pasted into the main message window and may introduce or remove characters, usually not visible, that were not in your log.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 14:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941446#M369344</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-28T14:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941453#M369347</link>
      <description>&lt;DIV&gt;Data temp (drop=z);&lt;/DIV&gt;&lt;DIV&gt;5 &amp;nbsp; &amp;nbsp;set work.complete22;&lt;/DIV&gt;&lt;DIV&gt;6 &amp;nbsp; &amp;nbsp;/* recoding age */&lt;/DIV&gt;&lt;DIV&gt;7 &amp;nbsp; &amp;nbsp;if AGE_KEY &amp;gt;=0 and AGE_KEY &amp;lt;= 4 then agegroup=1;&lt;/DIV&gt;&lt;DIV&gt;8 &amp;nbsp; &amp;nbsp;if &amp;nbsp;AGE_KEY &amp;gt;=5 &amp;nbsp;and AGE_KEY &amp;lt;= 9 then agegroup=2;&lt;/DIV&gt;&lt;DIV&gt;9 &amp;nbsp; &amp;nbsp;if &amp;nbsp;AGE_KEY &amp;gt;=10 and AGE_KEY &amp;lt;= 14 then agegroup=3;&lt;/DIV&gt;&lt;DIV&gt;10 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=15 &amp;nbsp;and AGE_KEY &amp;lt;= 19 then agegroup=4;&lt;/DIV&gt;&lt;DIV&gt;11 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=20 &amp;nbsp;and AGE_KEY &amp;lt;= 24 then agegroup=5;&lt;/DIV&gt;&lt;DIV&gt;12 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=25 &amp;nbsp;and AGE_KEY &amp;lt;=29 then agegroup=6;&lt;/DIV&gt;&lt;DIV&gt;13 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=30 &amp;nbsp;and AGE_KEY &amp;lt;= 34 then agegroup=7;&lt;/DIV&gt;&lt;DIV&gt;14 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=35 &amp;nbsp;and AGE_KEY &amp;lt;= 39 then agegroup=8;&lt;/DIV&gt;&lt;DIV&gt;15 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=40 &amp;nbsp;and AGE_KEY &amp;lt;= 44 then agegroup=9;&lt;/DIV&gt;&lt;DIV&gt;16 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=45 &amp;nbsp;and AGE_KEY &amp;lt;= 49 then agegroup=10;&lt;/DIV&gt;&lt;DIV&gt;17 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=50 &amp;nbsp;and AGE_KEY &amp;lt;= 54 then agegroup=11;&lt;/DIV&gt;&lt;DIV&gt;18 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=55 &amp;nbsp;and AGE_KEY &amp;lt;= 59 then agegroup=12;&lt;/DIV&gt;&lt;DIV&gt;19 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=60 &amp;nbsp;and AGE_KEY &amp;lt;= 64 then agegroup=13;&lt;/DIV&gt;&lt;DIV&gt;20 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=65 &amp;nbsp;and AGE_KEY &amp;lt;= 69 then agegroup=14;&lt;/DIV&gt;&lt;DIV&gt;21 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=70 &amp;nbsp;and AGE_KEY &amp;lt;= 74 then agegroup=15;&lt;/DIV&gt;&lt;DIV&gt;22 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=75 &amp;nbsp;and AGE_KEY &amp;lt;= 79 then agegroup=16;&lt;/DIV&gt;&lt;DIV&gt;23 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=80 &amp;nbsp;and AGE_KEY &amp;lt;= 84 then agegroup=17;&lt;/DIV&gt;&lt;DIV&gt;24 &amp;nbsp; if &amp;nbsp;AGE_KEY &amp;gt;=85 then agegroup=18;&lt;/DIV&gt;&lt;DIV&gt;25 &amp;nbsp; else if AGE_KEY =. then agegroup =19;&lt;/DIV&gt;&lt;DIV&gt;26&lt;/DIV&gt;&lt;DIV&gt;27 &amp;nbsp; /* &amp;nbsp; &amp;nbsp;*primary dx only;*/&lt;/DIV&gt;&lt;DIV&gt;28&lt;/DIV&gt;&lt;DIV&gt;29 &amp;nbsp; array DXS[18] $ dx1-dx18;&lt;/DIV&gt;&lt;DIV&gt;30 &amp;nbsp; CO_FLAG = 0;&lt;/DIV&gt;&lt;DIV&gt;31&lt;/DIV&gt;&lt;DIV&gt;32 &amp;nbsp; do z= 1 to 18;&lt;/DIV&gt;&lt;DIV&gt;33&lt;/DIV&gt;&lt;DIV&gt;34 &amp;nbsp; if substr(DXS {z},1,5) IN:('T5801' 'T5804' 'T5811' 'T5814' 'T5891' 'T5894' 'T5802’ ‘T5803’&lt;/DIV&gt;&lt;DIV&gt;34 ! ‘T5812’ ‘T5813’)&lt;/DIV&gt;&lt;DIV&gt;35&lt;/DIV&gt;&lt;DIV&gt;36 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; or substr(DXS {z},1,6)IN:(‘T582X2’ ‘T582X3’ ‘T588X3’ ‘T5892' 'T582X1' 'T582X4'&lt;/DIV&gt;&lt;DIV&gt;36 ! 'T588X1' 'T588X4')&lt;/DIV&gt;&lt;DIV&gt;37&lt;/DIV&gt;&lt;DIV&gt;38 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;or DXS{z} in: (‘T5882X2’)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;22&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;76&lt;/DIV&gt;&lt;DIV&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a datetime constant, a missing value, iterator, (.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;</description>
      <pubDate>Wed, 28 Aug 2024 14:50:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941453#M369347</guid>
      <dc:creator>Fadams12</dc:creator>
      <dc:date>2024-08-28T14:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941456#M369349</link>
      <description>&lt;P&gt;Please post the complete (from the DATA to the RUN statement) log of the step by copy/pasting the text into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 14:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941456#M369349</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-28T14:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941457#M369350</link>
      <description>&lt;P&gt;I think the code looks ok up to the point you stopped.&amp;nbsp; After that should be either an semicolon to define a subsetting if statement (probably not something you would do in the middle of a DO loop) or the THEN keyword to continue defining the IF statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise you might have introduced some invisible character, or perhaps one of those quotes is not actually a quote but is instead a typesetting "stupid" quote.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 15:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941457#M369350</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-28T15:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941459#M369351</link>
      <description>&lt;PRE&gt;1    data complete22;
2    set "C:\Users\hjt09632\Desktop\complete22.sas7bdat";
3    run;

NOTE: There were 750108 observations read from the data set
      C:\Users\hjt09632\Desktop\complete22.sas7bdat.
NOTE: The data set WORK.COMPLETE22 has 750108 observations and 77 variables.
NOTE: DATA statement used (Total process time):
      real time           1.82 seconds
      cpu time            0.45 seconds


4    Data temp (drop=z);
5    set work.complete22;
6    /* recoding age */
7    if AGE_KEY &amp;gt;=0 and AGE_KEY &amp;lt;= 4 then agegroup=1;
8    if  AGE_KEY &amp;gt;=5  and AGE_KEY &amp;lt;= 9 then agegroup=2;
9    if  AGE_KEY &amp;gt;=10 and AGE_KEY &amp;lt;= 14 then agegroup=3;
10   if  AGE_KEY &amp;gt;=15  and AGE_KEY &amp;lt;= 19 then agegroup=4;
11   if  AGE_KEY &amp;gt;=20  and AGE_KEY &amp;lt;= 24 then agegroup=5;
12   if  AGE_KEY &amp;gt;=25  and AGE_KEY &amp;lt;=29 then agegroup=6;
13   if  AGE_KEY &amp;gt;=30  and AGE_KEY &amp;lt;= 34 then agegroup=7;
14   if  AGE_KEY &amp;gt;=35  and AGE_KEY &amp;lt;= 39 then agegroup=8;
15   if  AGE_KEY &amp;gt;=40  and AGE_KEY &amp;lt;= 44 then agegroup=9;
16   if  AGE_KEY &amp;gt;=45  and AGE_KEY &amp;lt;= 49 then agegroup=10;
17   if  AGE_KEY &amp;gt;=50  and AGE_KEY &amp;lt;= 54 then agegroup=11;
18   if  AGE_KEY &amp;gt;=55  and AGE_KEY &amp;lt;= 59 then agegroup=12;
19   if  AGE_KEY &amp;gt;=60  and AGE_KEY &amp;lt;= 64 then agegroup=13;
20   if  AGE_KEY &amp;gt;=65  and AGE_KEY &amp;lt;= 69 then agegroup=14;
21   if  AGE_KEY &amp;gt;=70  and AGE_KEY &amp;lt;= 74 then agegroup=15;
22   if  AGE_KEY &amp;gt;=75  and AGE_KEY &amp;lt;= 79 then agegroup=16;
23   if  AGE_KEY &amp;gt;=80  and AGE_KEY &amp;lt;= 84 then agegroup=17;
24   if  AGE_KEY &amp;gt;=85 then agegroup=18;
25   else if AGE_KEY =. then agegroup =19;
26
27   /*    *primary dx only;*/
28
29   array DXS[18] $ dx1-dx18;
30   CO_FLAG = 0;
31
32   do z= 1 to 18;
33
34   if substr(DXS {z},1,5) IN:('T5801' 'T5804' 'T5811' 'T5814' 'T5891' 'T5894' 'T5802’ ‘T5803’
34 ! ‘T5812’ ‘T5813’)
35
36               or substr(DXS {z},1,6)IN:(‘T582X2’ ‘T582X3’ ‘T588X3’ ‘T5892' 'T582X1' 'T582X4'
36 ! 'T588X1' 'T588X4')
37
38                                    or DXS{z} in: (‘T5882X2’)
                                                     -
                                                     22
                                                     76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,
              a datetime constant, a missing value, iterator, (.

ERROR 76-322: Syntax error, statement will be ignored.

39
40               then CO_FLAG = 1;
41
42               leave;
43
44               END;
45
46               run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEMP may be incomplete.  When this step was stopped there were 0
         observations and 79 variables.
NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.04 seconds

&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Aug 2024 15:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941459#M369351</guid>
      <dc:creator>fadamso12</dc:creator>
      <dc:date>2024-08-28T15:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941462#M369352</link>
      <description>&lt;P&gt;So now you can SEE that the underscore is underneath that non-ASCII character you have on that line.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1724857963355.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99698iC09519FE60EE7F1A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1724857963355.png" alt="Tom_0-1724857963355.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just edit your code so that you are using actual quotes and not typesetting (word processing) special characters.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 15:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941462#M369352</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-28T15:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941465#M369353</link>
      <description>&lt;P&gt;I think the actual problem starts here:&lt;/P&gt;
&lt;PRE&gt; if substr(DXS {z},1,5) IN:('T5801' 'T5804' 'T5811' 'T5814' 'T5891' 'T5894' 'T5802&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;’&lt;/STRONG&gt;&lt;/FONT&gt; ‘T5803’&lt;/PRE&gt;
&lt;P&gt;The first quote from 'T5802 doesn't find a match until&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;36               or substr(DXS {z},1,6)IN:(‘T582X2’ ‘T582X3’ ‘T588X3’ ‘T5892&lt;FONT size="5" color="#0000FF"&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/FONT&gt; 'T582X1' 'T582X4'&lt;/PRE&gt;
&lt;P&gt;If the mismatched quote hadn't appeared as the second for T5802 the next value, T5803 would have shown the same error.&lt;/P&gt;
&lt;P&gt;So many of the comparisons are going to fail because of the mismatching of the programming quotes and the "curly" quotes.&lt;/P&gt;
&lt;P&gt;These curly quotes typically come from copying text from a different text source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 15:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941465#M369353</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-28T15:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941468#M369354</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468620"&gt;@Fadams12&lt;/a&gt;&amp;nbsp;(and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468622"&gt;@fadamso12&lt;/a&gt;)&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition to the "curly quotes" issue there seems to be a logic error in your code, which the SAS log does not complain about:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468622"&gt;@fadamso12&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;40               then CO_FLAG = 1;
41
42               leave;
43
44               END;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The LEAVE statement is executed &lt;EM&gt;unconditionally&lt;/EM&gt;. Hence, the IF condition is checked for z=1 only. Most likely, your intention was to write&lt;/P&gt;
&lt;PRE&gt; then &lt;STRONG&gt;do;&lt;/STRONG&gt;
   CO_FLAG = 1;
   leave;
 &lt;STRONG&gt;end;
&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;before the closing END statement of the DO loop, so that the checks are applied to z=2, 3, ... as well,&amp;nbsp;&lt;EM&gt;until&lt;/EM&gt; the first value satisfying the IF condition (if any).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 15:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941468#M369354</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-08-28T15:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941482#M369356</link>
      <description>&lt;P&gt;Those curly quotes which cause your trouble might come from some editing in a word processor; do not use such for coding.&lt;/P&gt;
&lt;P&gt;If you're not happy with the SAS-supplied editors, use something like Notepad++ or a coding environment, but never Word or similar.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 16:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941482#M369356</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-28T16:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941506#M369365</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Thank you all for the support. This is my first using the array and doing loops, so bear with me. I want this code to&amp;nbsp;&lt;SPAN&gt;the checks applied to z=2, 3, so should I remove the LEAVE? Also, after correcting the issue with quotes, now it's a loop, not closed. I have tried to end and run twice, but both do not work.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;258  Data temp (drop=z);
259  set work.complete22;
260  array DXS[18] $ dx1-dx18;
261  CO_FLAG = 0;
262
263  do z= 1 to 18;
264
265  if substr(DXS {z},1,5) IN:('T5801' 'T5804' 'T5811' 'T5814' 'T5891' 'T5894' 'T5802' 'T5803'
265! 'T5812' 'T5813')
266
267              or substr(DXS {z},1,6)IN:('T582X2' 'T582X3' 'T588X3' 'T5892' 'T582X1' 'T582X4'
267! 'T588X1' 'T588X4')
268
269                                   or  DXS{z} in:('T5882X2')
270
271              then do;
272              CO_FLAG = 1;
273              leave;
274              end;
275              run;

275              run;
                    -
                    117
ERROR 117-185: There was 1 unclosed DO block.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEMP may be incomplete.  When this step was stopped there were 0
         observations and 78 variables.
WARNING: Data set WORK.TEMP was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


276              end;
                 ---
                 180

ERROR 180-322: Statement is not valid or it is used out of proper order.

277              run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 28 Aug 2024 16:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941506#M369365</guid>
      <dc:creator>fadamso12</dc:creator>
      <dc:date>2024-08-28T16:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941717#M369422</link>
      <description>&lt;P&gt;Can someone please help me fix this code loop? It&lt;/P&gt;&lt;PRE&gt;Data temp (drop=z); 
set work.complete22;
array DXS[18] $ dx1-dx18;
CO_FLAG = 0;

do z= 1 to 18;

if substr(DXS {z},1,5) IN:('T5801' 'T5804' 'T5811' 'T5814' 'T5891' 'T5894' 'T5802' 'T5803' 'T5812' 'T5813')

            or substr(DXS {z},1,6)IN:('T582X2' 'T582X3' 'T588X3' 'T5892' 'T582X1' 'T582X4' 'T588X1' 'T588X4')

                                 or  DXS{z} in:('T5882X2')

        
		then do CO_FLAG = 1;
         leave;
			end;
			end;
           	run;&lt;/PRE&gt;&lt;P&gt;is not working. It only flags Zero's&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 13:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941717#M369422</guid>
      <dc:creator>fadamso12</dc:creator>
      <dc:date>2024-08-29T13:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941720#M369423</link>
      <description>&lt;P&gt;Can you please show us a small portion of the data that should not produce a zero? From now on, can you please show us the log as we requested earlier?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 13:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941720#M369423</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-29T13:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941722#M369424</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468622"&gt;@fadamso12&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;		then do CO_FLAG = 1;
         leave;
			end;
&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You omitted the semicolon after the DO statement, which changes the meaning of the code.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 13:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/941722#M369424</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-08-29T13:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/942462#M369553</link>
      <description>&lt;P&gt;Can you try this and see if it works for you.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Corrections made:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Replaced curly braces &lt;CODE&gt;{}&lt;/CODE&gt; with square brackets &lt;CODE&gt;[]&lt;/CODE&gt; for referencing array elements.&lt;/LI&gt;&lt;LI&gt;Fixed the single quotes around the string constants (changed them from “curly” quotes to straight quotes).&lt;/LI&gt;&lt;LI&gt;Ensured the &lt;CODE&gt;IN&lt;/CODE&gt; operator was used properly by separating the values with commas and enclosing them in parentheses.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This should resolve the syntax errors you were encountering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data temp (drop=z);
    set work.complete22;
    array DXS[18] $ dx1-dx18;
    CO_FLAG = 0;

    do z= 1 to 18;
        if substr(DXS[z],1,5) IN ('T5801', 'T5804', 'T5811', 'T5814', 'T5891', 'T5894', 'T5802', 'T5803', 'T5812', 'T5813') 
            or substr(DXS[z],1,6) IN ('T582X2', 'T582X3', 'T588X3', 'T5892', 'T582X1', 'T582X4', 'T588X1', 'T588X4') 
            or DXS[z] in ('T5882X2') then CO_FLAG = 1;
        leave;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 13:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/942462#M369553</guid>
      <dc:creator>Sarath_A_SAS</dc:creator>
      <dc:date>2024-09-04T13:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943675#M369837</link>
      <description>&lt;P&gt;Hello, everyone. Can someone help me fix this code? I am trying to summarize data by the following variables: age group, county, year admitted admissionmonth, race, and sex. Below is a snippet of the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fadamso12_1-1726160062230.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/100261i90492BA94D6152C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fadamso12_1-1726160062230.png" alt="fadamso12_1-1726160062230.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql number;
create table rr as 
select distinct AdmissionMonth, AgeGroup, County, Ethnicity, Race, HealthOutcomeID, MonthlyHosp, 
Sex, ADYEAR,
count (case when ASTHMA_FLAG=1 
from count_Asthma
group by AdmissionMonth, AgeGroup, County, Ethnicity, Race, HealthOutcomeID, MonthlyHosp, 
		Sex, ADYEAR; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Sep 2024 16:57:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943675#M369837</guid>
      <dc:creator>fadamso12</dc:creator>
      <dc:date>2024-09-12T16:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943677#M369838</link>
      <description>&lt;P&gt;You are missing a right parenthesis. And even if you fix that, your CASE WHEN is incomplete.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 17:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943677#M369838</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-09-12T17:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943679#M369840</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, if you don't mind, can you tell me the syntax? I have never created a table using SQL before, so I am trying it for the first time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 17:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943679#M369840</guid>
      <dc:creator>fadamso12</dc:creator>
      <dc:date>2024-09-12T17:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943681#M369842</link>
      <description>&lt;P&gt;From code that doesn't work, I would need to know what this SQL is supposed to do in order to get it to work, especially the part where you get the error, what are you trying to do?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 17:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943681#M369842</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-09-12T17:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant,</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943687#M369843</link>
      <description>&lt;P&gt;First thing is you should be systematic in your code layout so it will be easier for you to spot places where your code fails to follow the pattern.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create table rr as 
select distinct
    AdmissionMonth
  , AgeGroup
  , County
  , Ethnicity
  , Race
  , HealthOutcomeID
  , MonthlyHosp
  , Sex
  , ADYEAR
  , count (case when ASTHMA_FLAG=1
from count_Asthma
group by AdmissionMonth
       , AgeGroup
       , County
       , Ethnicity
       , Race
       , HealthOutcomeID
       , MonthlyHosp
       , Sex
       , ADYEAR
; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the place where normal patterns breakdown is in your call to the COUNT() aggregate function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;count (case when ASTHMA_FLAG=1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You have the opening ( that indicates the start of the function arguments, but you never added any closing ).&lt;/P&gt;
&lt;P&gt;You also have the start of a CASE clause, but you never finish it with an END keyword.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to count the number of times that variable has a value of 1?&amp;nbsp; You could finish the CASE like this so that COUNT has a value that is either populated (always 1 in the case) or missing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;count (case when ASTHMA_FLAG=1 then asthma_flag else . end)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you might want to ADD instead of COUNT to get the number instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum(case when ASTHMA_FLAG=1 then 1 else 0 end)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which in SAS can be simplified to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum(ASTHMA_FLAG=1)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;since SAS will evaluate such a boolean expression as either 1 (TRUE) or 0 (FALSE).&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 18:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Syntax-error-expecting-one-of-the-following-a/m-p/943687#M369843</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-12T18:08:51Z</dc:date>
    </item>
  </channel>
</rss>

