<?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 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770636#M244502</link>
    <description>&lt;PRE&gt;9692 else if icd9(i) in:('2504'&amp;lt;=:icd9(i)&amp;lt;=:'2507') then diabetes_comp = 1;
-- -
79 388
200&lt;/PRE&gt;
&lt;P&gt;The IN list must be a list of literals(constants); you cannot use comparison operators in there.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Sep 2021 13:35:19 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-09-27T13:35:19Z</dc:date>
    <item>
      <title>ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770579#M244492</link>
      <description>&lt;P&gt;Hi all, I am really frustrated. I just changed the code definition for certain comorbidities using the same format as the original NCI macro code. However, I got the following error. Could you please help me to identify the problem? I sincerely appreciate your time and help. (I attached the log and original code below for your reference)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;9643 data first_record_test;
9644 set merged_final;
9645
9646 array icd9 {*} case_1_d0 case_1_d1 case_1_d2 case_1_d3 case_1_d4 case_1_d5
9646! case_1_d6 case_1_d7 case_1_d8 case_1_d9
9647 case_1_p1 case_1_p2 case_1_p3 case_1_p4 case_1_p5 case_1_p6
9647! case_1_p7 case_1_p8 case_1_p9 case_1_p10
9648 case_1_p11 case_1_p12 case_1_p13 case_1_p14 case_1_p15 case_1_p16
9648! case_1_p17 case_1_p18 case_1_p19 case_1_p20
9649 case_1_p21 case_1_p22 case_1_p23 case_1_p24 case_1_p25 case_1_p26
9649! case_1_p27 case_1_p28 case_1_p29 case_1_p30;
9650
9651 do i=1 to dim(icd9);
9652
9653 *** ACUTE MYOCARDIAL INFARCTION;
9654 if icd9(i) in:('410') then acute_mi = 1;
9655
9656
9657 *** HISTORY OF MYOCARDIAL INFARCTION;
9658 else if icd9(i) in:('412') then history_mi = 1;
9659
9660
9661 *** CONGESTIVE HEART FAILURE;
9662 else if icd9(i)
9662! in:('39891','40201','40211','40291','40401','40403','40411','40413','40491','40493',
9663 '4254','4255','4256','4257','4258','4259','428')then chf = 1;
9664
9665
9666 *** PERIPHERAL VASCULAR DISEASE;
9667 else if icd9(i) in:('0930','440','441','4471','5571','5579','V434') or
9668 ('4431'&amp;lt;=:icd9(i)&amp;lt;=:'4439') then pvd = 1;
9669
9670
9671 *** CEREBROVASCULAR DISEASE;
9672 else if icd9(i) in:('36234') or ('430'&amp;lt;=:icd9(i)&amp;lt;=:'438') then cvd = 1;
9673
9674
9675 *** COPD;
9676 else if icd9(i) in:('4168','4169','5064','5081','5088') or ('490'&amp;lt;=:icd9(i)&amp;lt;=:'505')
9676! then copd = 1;
9677
9678
9679 *** DEMENTIA;
9680 else if icd9(i) in:('290','2941','3312') then dementia = 1;
9681
9682
9683 *** PARALYSIS;
9684 else if icd9(i) in:('3341','342','343','3449') or ('3440'&amp;lt;=:icd9(i)&amp;lt;=:'3446') then
9684! paralysis = 1;
9685
9686
9687 *** DIABETES;
9688 else if icd9(i) in:('2508','2509') or ('2500'&amp;lt;=:icd9(i)&amp;lt;=:'2503') then diabetes = 1;
9689
9690
9691 *** DIABETES WITH COMPLICATIONS;
9692 else if icd9(i) in:('2504'&amp;lt;=:icd9(i)&amp;lt;=:'2507') then diabetes_comp = 1;
-- -
79 388
200
ERROR 79-322: Expecting a ).

ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

9693
9694
9695 *** MODERATE-SEVERE RENAL DISEASE;
9696 else if icd9(i)
----
160
9696! in:('40301','40311','40391','40402','40403','40412','40413','40492','40493',
ERROR 160-185: No matching IF-THEN clause.

9697 '582','585','586','5880','V420','V451','V56') or
9697! ('5830'&amp;lt;=:icd9(i)&amp;lt;=:'5837') then renal_disease = 1;
9698
9699
9700 *** MILD LIVER DISEASE;
9701 else if icd9(i)
9701! in:('07022','07023','07032','07033','07044','07054','0706','0709','570','571','5733','5734'
9701! ,'5738','5739','V427') then mild_liver_disease = 1;
9702
9703
9704 *** MODERATE-SEVERE LIVER DISEASE;
9705 else if icd9(i) in:
9706 ('4560'&amp;lt;=:icd9(i)&amp;lt;=:'4562') or
-- -
79 388
200
76
ERROR 79-322: Expecting a ).

ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

ERROR 76-322: Syntax error, statement will be ignored.

9707 ('5722'&amp;lt;=:icd9(i)&amp;lt;=:'5728') then liver_disease = 1;
9708
9709
9710 *** PEPTIC ULCER DISEAS;
9711 else if ('531'&amp;lt;=:icd9(i)&amp;lt;=:'534') then ulcers = 1;
9712
9713
9714 *** RHEUMATOLOGIC DISEASE;
9715 else if icd9(i) in:('4465','7100','7101','7102','7103','7104','7148','725') or
9715! ('7140'&amp;lt;=:icd9(i)&amp;lt;=:'7142') then rheum_disease = 1;
9716
9717 *'4465','7102','7103','7148';
9718
9719 *** AIDS;
9720 else if icd9(i) in:('042'&amp;lt;=:icd9(i)&amp;lt;=:'044') then aids = 1;
-- -
79 388
200
ERROR 79-322: Expecting a ).

ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

9721
9722
9723 end; *** End diagnosis code loop;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Original code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data first_record_test;
set merged_final;

array icd9 {*} case_1_d0 case_1_d1 case_1_d2 case_1_d3 case_1_d4 case_1_d5 case_1_d6 case_1_d7 case_1_d8 case_1_d9
case_1_p1 case_1_p2 case_1_p3 case_1_p4 case_1_p5 case_1_p6 case_1_p7 case_1_p8 case_1_p9 case_1_p10
case_1_p11 case_1_p12 case_1_p13 case_1_p14 case_1_p15 case_1_p16 case_1_p17 case_1_p18 case_1_p19 case_1_p20
case_1_p21 case_1_p22 case_1_p23 case_1_p24 case_1_p25 case_1_p26 case_1_p27 case_1_p28 case_1_p29 case_1_p30;

do i=1 to dim(icd9);

*** ACUTE MYOCARDIAL INFARCTION;
if icd9(i) in:('410') then acute_mi = 1;


*** HISTORY OF MYOCARDIAL INFARCTION;
else if icd9(i) in:('412') then history_mi = 1;


*** CONGESTIVE HEART FAILURE;
else if icd9(i) in:('39891','40201','40211','40291','40401','40403','40411','40413','40491','40493',
'4254','4255','4256','4257','4258','4259','428')then chf = 1;


*** PERIPHERAL VASCULAR DISEASE;
else if icd9(i) in:('0930','440','441','4471','5571','5579','V434') or
('4431'&amp;lt;=:icd9(i)&amp;lt;=:'4439') then pvd = 1;


*** CEREBROVASCULAR DISEASE;
else if icd9(i) in:('36234') or ('430'&amp;lt;=:icd9(i)&amp;lt;=:'438') then cvd = 1;


*** COPD;
else if icd9(i) in:('4168','4169','5064','5081','5088') or ('490'&amp;lt;=:icd9(i)&amp;lt;=:'505') then copd = 1;


*** DEMENTIA;
else if icd9(i) in:('290','2941','3312') then dementia = 1;


*** PARALYSIS;
else if icd9(i) in:('3341','342','343','3449') or ('3440'&amp;lt;=:icd9(i)&amp;lt;=:'3446') then paralysis = 1;


*** DIABETES;
else if icd9(i) in:('2508','2509') or ('2500'&amp;lt;=:icd9(i)&amp;lt;=:'2503') then diabetes = 1;


*** DIABETES WITH COMPLICATIONS;
else if icd9(i) in:('2504','2505','2506','2507') then diabetes_comp = 1;


*** MODERATE-SEVERE RENAL DISEASE;
else if icd9(i) in:('40301','40311','40391','40402','40403','40412','40413','40492','40493',
'582','585','586','5880','V420','V451','V56') or ('5830'&amp;lt;=:icd9(i)&amp;lt;=:'5837') then renal_disease = 1;


*** MILD LIVER DISEASE;
else if icd9(i) in:('07022','07023','07032','07033','07044','07054','0706','0709','570','571','5733','5734','5738','5739','V427') then mild_liver_disease = 1;


*** MODERATE-SEVERE LIVER DISEASE;
else if icd9(i) in:
('4560'&amp;lt;=:icd9(i)&amp;lt;=:'4562') or
('5722'&amp;lt;=:icd9(i)&amp;lt;=:'5728') then liver_disease = 1;


*** PEPTIC ULCER DISEAS;
else if ('531'&amp;lt;=:icd9(i)&amp;lt;=:'534') then ulcers = 1;


*** RHEUMATOLOGIC DISEASE;
else if icd9(i) in:('4465','7100','7101','7102','7103','7104','7148','725') or ('7140'&amp;lt;=:icd9(i)&amp;lt;=:'7142') then rheum_disease = 1;

*'4465','7102','7103','7148';

*** AIDS;
else if icd9(i) in:('042'&amp;lt;=:icd9(i)&amp;lt;=:'044') then aids = 1;


end; *** End diagnosis code loop;


*** Define arrays for comorbidity condition;
array comorb (*) acute_mi--aids;
*if last.&amp;amp;PATID then do;
do i=1 to dim(comorb);
if comorb(i)=. then comorb(i) = 0;
end;

*** Calculate the Charlson Comorbidity Score for prior conditions;
Charlson =
1*(acute_mi or history_mi) +
1*(chf) +
1*(pvd) +
1*(cvd) +
1*(copd) +
1*(dementia) +
2*(paralysis) +
1*(diabetes and not diabetes_comp) +
2*(diabetes_comp) +
2*(renal_disease) +
1*(mild_liver_disease and not liver_disease) +
3*(liver_disease) +
1*(ulcers) +
1*(rheum_disease) +
6*(aids);

*** Calculate the NCI Comorbidity Index for prior conditions;
NCIindex =
1.14*(acute_mi) +
1.08*(history_mi) +
1.91*(chf) +
1.30*(pvd) +
1.32*(cvd) +
1.69*(copd) +
2.06*(dementia) +
1.49*(paralysis) +
1.34*(diabetes or diabetes_comp) +
1.60*(renal_disease) +
2.09*(mild_liver_disease or liver_disease) +
1.08*(ulcers) +
1.25*(rheum_disease) +
1.79*(aids);

output;


keep PATIENT_ID_NUMBER_N20 linenumber

case_1_d0 case_1_d1 case_1_d2 case_1_d3 case_1_d4 case_1_d5 case_1_d6 case_1_d7 case_1_d8 case_1_d9
case_1_p1 case_1_p2 case_1_p3 case_1_p4 case_1_p5 case_1_p6 case_1_p7 case_1_p8 case_1_p9 case_1_p10
case_1_p11 case_1_p12 case_1_p13 case_1_p14 case_1_p15 case_1_p16 case_1_p17 case_1_p18 case_1_p19 case_1_p20
case_1_p21 case_1_p22 case_1_p23 case_1_p24 case_1_p25 case_1_p26 case_1_p27 case_1_p28 case_1_p29 case_1_p30

acute_mi--aids Charlson NCIindex;

label
Charlson = 'Charlson comorbidity score'
NCIindex = 'NCI comorbidity index'
acute_mi = 'Acute Myocardial Infarction'
history_mi = 'History of Myocardial Infarction'
chf = 'Congestive Heart Failure'
pvd = 'Peripheral Vascular Disease'
cvd = 'Cerebrovascular Disease'
copd = 'Chronic Obstructive Pulmonary Disease'
dementia = 'Dementia'
paralysis = 'Hemiplegia or Paraplegia'
diabetes = 'Diabetes'
diabetes_comp = 'Diabetes with Complications'
renal_disease = 'Moderate-Severe Renal Disease'
mild_liver_disease = 'Mild Liver Disease'
liver_disease = 'Moderate-Severe Liver Disease'
ulcers = 'Peptic Ulcer Disease'
rheum_disease = 'Rheumatologic Disease'
aids = 'AIDS'
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 08:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770579#M244492</guid>
      <dc:creator>oddsratio</dc:creator>
      <dc:date>2021-09-27T08:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770603#M244497</link>
      <description>&lt;P&gt;What part did you change?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 11:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770603#M244497</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-27T11:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770606#M244498</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/400431"&gt;@oddsratio&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;The "original code" already contains two syntax errors:&lt;/P&gt;
&lt;PRE&gt;*** MODERATE-SEVERE LIVER DISEASE;
else if &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;icd9(i) in:&lt;/STRONG&gt;&lt;/FONT&gt;
('4560'&amp;lt;=:icd9(i)&amp;lt;=:'4562') or
('5722'&amp;lt;=:icd9(i)&amp;lt;=:'5728') then liver_disease = 1;&lt;/PRE&gt;
&lt;PRE&gt;*** AIDS;
else if &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;icd9(i) in:&lt;/STRONG&gt;&lt;/FONT&gt;('042'&amp;lt;=:icd9(i)&amp;lt;=:'044') then aids = 1;&lt;/PRE&gt;
&lt;P&gt;The parts highlighted in red must be deleted in order to obtain correct Boolean expressions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears that you added more of this pattern, e.g., in section "&lt;FONT face="courier new,courier"&gt;DIABETES WITH COMPLICATIONS&lt;/FONT&gt;".&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 12:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770606#M244498</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-09-27T12:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770636#M244502</link>
      <description>&lt;PRE&gt;9692 else if icd9(i) in:('2504'&amp;lt;=:icd9(i)&amp;lt;=:'2507') then diabetes_comp = 1;
-- -
79 388
200&lt;/PRE&gt;
&lt;P&gt;The IN list must be a list of literals(constants); you cannot use comparison operators in there.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 13:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770636#M244502</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-27T13:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770647#M244504</link>
      <description>Thank you so much!</description>
      <pubDate>Mon, 27 Sep 2021 14:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770647#M244504</guid>
      <dc:creator>oddsratio</dc:creator>
      <dc:date>2021-09-27T14:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770648#M244505</link>
      <description>Thank you! I will look into it!</description>
      <pubDate>Mon, 27 Sep 2021 15:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770648#M244505</guid>
      <dc:creator>oddsratio</dc:creator>
      <dc:date>2021-09-27T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770650#M244506</link>
      <description>&lt;P&gt;You want to be &lt;STRONG&gt;extremely cautious&lt;/STRONG&gt; of using "range" values with character values.&lt;/P&gt;
&lt;P&gt;Please run this code and examine the log:&lt;/P&gt;
&lt;PRE&gt;data example;
  icd9 = '4';

   if ('430'&amp;lt;=:icd9&amp;lt;=:'438') then put "Icd9 is in range";
   else put "Not in range";
run;&lt;/PRE&gt;
&lt;P&gt;"4" is in the range "430" to "438" because character values are compared first character to first character, then second and so on. So I suspect a fair number of your comparisons are incorrect depending on the possible range of your actual ICD values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your use of IN: also means that you very likely can get incorrect assignments:&lt;/P&gt;
&lt;PRE&gt;data example;
   icd='4';
   if icd in:('410') then put "found";
run;&lt;/PRE&gt;
&lt;P&gt;also matches "4" as in the range for "410".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally instead of a bunch of If statements I would move the assignment of lists of values to a Format or Informat with all of the codes actually present, or possible, in the data as explicit lists.&lt;/P&gt;
&lt;P&gt;One way:&lt;/P&gt;
&lt;PRE&gt;proc format;
value $icdexample
'410' ='Acute MI'
'412' ='History MI'
'2508','2509' ='Diabetes'
other = "Not listed"
;
run;


data example;
   input icd $;
   if put(icd,$icdexample.)="Acute MI" then acute_mi=1;
   if put(icd,$icdexample.)="History MI" then history_mi=1;
   if put(icd,$icdexample.)="Diabetes" then diabetes=1;
datalines;
410
412
2508
2509
abc
run;&lt;/PRE&gt;
&lt;P&gt;I realize this does not have all of the ICD codes for any condition. But you can convert a document with the complete list, or extract the codes present in your data, to a data set and use that information to create formats.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 15:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770650#M244506</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-27T15:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 79-322 Expecting a ) / ERROR 388-185: Expecting an arithmetic operator / ERROR 200-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770800#M244513</link>
      <description>&lt;P&gt;Thank you so much for your detailed instruction!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 03:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-ERROR-388-185-Expecting-an-arithmetic/m-p/770800#M244513</guid>
      <dc:creator>oddsratio</dc:creator>
      <dc:date>2021-09-28T03:37:55Z</dc:date>
    </item>
  </channel>
</rss>

