<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566372#M159167</link>
    <description>&lt;P&gt;OHHHH - sorry blonde roots.. I see what you are saying.. let me try that! Hang on!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 15 Jun 2019 15:50:35 GMT</pubDate>
    <dc:creator>Blndbrm727</dc:creator>
    <dc:date>2019-06-15T15:50:35Z</dc:date>
    <item>
      <title>Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566367#M159162</link>
      <description>&lt;P&gt;Hello All-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting this error. I have retyped that portion of the code and it did not work. Thank you in advance!&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Code: 
If Fent=1 or Opiate=1 or Methd=1 or Oxy=1 or AMP=1 or MDMA=1 or COC= or Metam=1 or THC= or PCP=1 or Benzo=1 or Barb=1
or Ethn=1 or TCA=1 then Anydrug_Positive="YES";
else Anydrug_Positive="NO";

Log:
867  If Fent=1 or Opiate=1 or Methd=1 or Oxy=1 or AMP=1 or MDMA=1 or COC= or Metam=1 or THC= or
                                                                             -----
---
                                                                             22                 22
867! PCP=1 or Benzo=1 or Barb=1
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,
              [, ^=, {, |, ||, ~=.

868  or Ethn=1 or TCA=1 then Anydrug_Positive="YES";
869  else Anydrug_Positive="NO";&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 15:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566367#M159162</guid>
      <dc:creator>Blndbrm727</dc:creator>
      <dc:date>2019-06-15T15:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566368#M159163</link>
      <description>Hi: &lt;BR /&gt;Are you sure that ALL your conditions are correct? For example, what do you hope to find with &lt;BR /&gt;COC= and THC= &lt;BR /&gt;should it be COC=1 and THC=1???&lt;BR /&gt;&lt;BR /&gt;What are the values of COC and THC that you are testing for? &lt;BR /&gt;&lt;BR /&gt;  Typically in an OR condition, you have something like this:&lt;BR /&gt;IF var1=value1 OR var2=value2 OR var3=value3 then  newvar = newvalue;&lt;BR /&gt;So it seems to me that there is something wrong with how you have constructed the OR conditions for COC and THC variables.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Sat, 15 Jun 2019 15:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566368#M159163</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-06-15T15:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566369#M159164</link>
      <description>&lt;P&gt;These are all drugs. COC= cocaine. THC= marijuana. All are substances on toxicology panels and are coded in my database as 0=negative 1=positive 2=not tested. In this particular command I am trying to code for any one of the substances being a "1" or positive. I have done the same for "0" or being any drug negative and it worked perfectly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is interesting is each time I retype the code for the variable SAS gets hung up on ( at first it was METAM (methamphetamine) SAS moves to a different variable.&amp;nbsp; It is now hung up on PCP. I Have retyped the PCP variable code 3 times but it is not moving off it. I am perplexed. Would (&amp;nbsp; &amp;nbsp;) around the code help?&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 15:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566369#M159164</guid>
      <dc:creator>Blndbrm727</dc:creator>
      <dc:date>2019-06-15T15:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566370#M159165</link>
      <description>&lt;P&gt;you must supply a value for this&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;&amp;nbsp;COC= or Metam=1 or THC= &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;COC=&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;THC=&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;that is what the error is telling you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;try replacing the above with&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&lt;SPAN style="background-color: #eaeaea; color: #333333; display: inline; float: none; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;COC=1 or Metam=1 or THC=1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 15:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566370#M159165</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-06-15T15:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566371#M159166</link>
      <description>&lt;PRE&gt;My code has all values assigned:
If Fent=1 or Opiate=1 or Methd=1 or Oxy=1 or AMP=1 or MDMA=1 or COC=1 or METAM=1 or THC=1 or PCP=1 or Benzo=1 or Barb=1 or Ethn=1 or TCA=1 then Anydrug_Positive="YES";
else Anydrug_Positive="NO";

But the log is not showing those values assigned:
1458  If Fent=1 or Opiate=1 or Methd=1 or Oxy=1 or AMP=1 or MDMA=1 or COC=1 or Metam=1 or THC= or
1458! PCP=1 or Benzo=1 or Barb=1 or Ethn=1 or TCA=1 then Anydrug_Positive="YES";
      ---
      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,
              [, ^=, {, |, ||, ~=.

1459  else Anydrug_Positive="NO";&lt;/PRE&gt;&lt;P&gt;Can anyone explain this&amp;gt; I have retyped the code the code manually and yet the log keeps doing this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 15:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566371#M159166</guid>
      <dc:creator>Blndbrm727</dc:creator>
      <dc:date>2019-06-15T15:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566372#M159167</link>
      <description>&lt;P&gt;OHHHH - sorry blonde roots.. I see what you are saying.. let me try that! Hang on!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 15:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566372#M159167</guid>
      <dc:creator>Blndbrm727</dc:creator>
      <dc:date>2019-06-15T15:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566373#M159168</link>
      <description>&lt;P&gt;the error still points to the THC=&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your THC value in the if statement doesn't match what SAS sees when it evaluates THC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;just for kick try making 2 if statements&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;If Fent=1 or Opiate=1 or Methd=1 or Oxy=1 or AMP=1 or MDMA=1 or COC=1 or METAM=1 &lt;SPAN style="background-color: #eaeaea; color: #333333; display: inline; float: none; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;then Anydrug_Positive="YES";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 1em; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;else if THC=1 or PCP=1 or Benzo=1 or Barb=1 or Ethn=1 or TCA=1 then Anydrug_Positive="YES";&lt;BR /&gt;else Anydrug_Positive="NO";&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 15:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566373#M159168</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-06-15T15:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566374#M159169</link>
      <description>&lt;PRE&gt;If Fent=1 or Opiate=1 or Methd=1 or Oxy=1 or MP=1 or MDMA=1 or COC=1 or
 METAM=1 or THC=1 or PCP=1 or Benzo=1 or 
Barb=1 or Ethn=1 or TCA=1 then Anydrug_Positive="YES";
else Anydrug_Positive="NO";

The above is my code. So every drug has a value of "1" assigned and I am still getting the error on PCP.&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Jun 2019 15:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566374#M159169</guid>
      <dc:creator>Blndbrm727</dc:creator>
      <dc:date>2019-06-15T15:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566375#M159170</link>
      <description>&lt;P&gt;most of the time when you see those ----- marks on the error statement in the log the problem is just before those marks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if PCP=1 and has underlines under it the problem would be the element being evaluated prior to that.&amp;nbsp; In your if statement that looks like THC is still null in your statement when SAS executes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are putting THC=1 and that is the error maybe THC has a type of character where you would need to put THC="1"&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 16:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566375#M159170</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-06-15T16:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error 22-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566378#M159171</link>
      <description>&lt;P&gt;SUCCESS!! THANK YOU VDD! I am working on a first of its kind biosurveillance system in the US for the CDC. and Giving my first report on Wednesday So trying to run all this data over the weekend. I appreciate everyone's help on this. I will probably be back on here again as I learn all the ins and outs of SAS!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 16:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-22-322/m-p/566378#M159171</guid>
      <dc:creator>Blndbrm727</dc:creator>
      <dc:date>2019-06-15T16:19:10Z</dc:date>
    </item>
  </channel>
</rss>

