<?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 Creating new variable and formulating its value to depend on other variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-and-formulating-its-value-to-depend-on/m-p/436809#M108687</link>
    <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I am having trouble creating a new variable "&lt;STRONG&gt;disease&lt;/STRONG&gt;" that would determine whether or not the subject has the disease &lt;STRONG&gt;(1)&lt;/STRONG&gt; or does not &lt;STRONG&gt;(0)&lt;/STRONG&gt;, depending on the symptoms listed on 5 different variables. If patient has sympt1-sympt3 (heartburns, sickness, and spasm) without sympt4 and/or sympt5 (temperature and/ or tiredness), then patient has disease (1). If the conditions are any different then disease should equal 0.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="project3 task2 table.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18499i4FF11C2DC6FB40EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="project3 task2 table.PNG" alt="project3 task2 table.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;CODE:&lt;/P&gt;&lt;P&gt;options nodate nonumber;&lt;BR /&gt;****1.IMPORT;&lt;BR /&gt;%macro P3 (a, b, c, d);&lt;BR /&gt;proc import out= &amp;amp;a&lt;BR /&gt;datafile= "C:\HW5\&amp;amp;b"&lt;BR /&gt;dbms=xlsx replace;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=&amp;amp;a;&lt;BR /&gt;by &amp;amp;c &amp;amp;d;&lt;BR /&gt;run;&lt;BR /&gt;Proc print data = &amp;amp;a;&lt;BR /&gt;Run;&lt;BR /&gt;%mend P3;&lt;/P&gt;&lt;P&gt;%P3 (PROJECT3_F17, Project3.xlsx, id_no, symptom_no);&lt;BR /&gt;***2.REORGANIZE variables: USE ARRAY STATEMENT ALONG WITH FIRST.ID and LAST.ID;&lt;BR /&gt;data sympt (drop=symptom_no symptom);&lt;BR /&gt;set PROJECT3_F17;&lt;BR /&gt;retain sympt1-sympt5;&lt;BR /&gt;length sympt1-sympt5 $15;&lt;BR /&gt;array symptoms (5) $15. sympt1-sympt5;&lt;BR /&gt;by id_no;&lt;BR /&gt;if first.id_no then call missing(of symptoms(*));&lt;BR /&gt;symptoms(symptom_no)=symptom;&lt;BR /&gt;if last.id_no then output;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=sympt;&lt;BR /&gt;run;&lt;BR /&gt;&lt;STRONG&gt;***3.Set disease=1 if sympt1+sympt2+sympt3 and no sympt4-sympt5 WORK OFF DATA SET SYMPT;&lt;/STRONG&gt;&lt;BR /&gt;data dis_01 (drop=answer);&lt;BR /&gt;set sympt;&lt;BR /&gt;retain disease;&lt;BR /&gt;array dpthdisease (1) disease;&lt;BR /&gt;by id_no;&lt;BR /&gt;if first.id_no then dpthdisease (symp1-sympt5)=answer;&lt;BR /&gt;If answer EQ sympt1-sympt3 and NE sympt4 OR sympt5 then disease=1;&lt;BR /&gt;else disease=0;&lt;BR /&gt;if last.id_no then output;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=disease;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;LOG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 options nodate nonumber;&lt;BR /&gt;2 ****1.IMPORT;&lt;BR /&gt;3 %macro P3 (a, b, c, d);&lt;BR /&gt;4 proc import out= &amp;amp;a&lt;BR /&gt;5 datafile= "C:\HW5\&amp;amp;b"&lt;BR /&gt;6 dbms=xlsx replace;&lt;BR /&gt;7 getnames=yes;&lt;BR /&gt;8 run;&lt;BR /&gt;9 proc sort data=&amp;amp;a;&lt;BR /&gt;10 by &amp;amp;c &amp;amp;d;&lt;BR /&gt;11 run;&lt;BR /&gt;12 Proc print data = &amp;amp;a;&lt;BR /&gt;13 Run;&lt;BR /&gt;14 %mend P3;&lt;BR /&gt;15&lt;BR /&gt;16 %P3 (PROJECT3_F17, Project3.xlsx, id_no, symptom_no);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: The import data set has 18082 observations and 3 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: WORK.PROJECT3_F17 data set was successfully created.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 1.41 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.85 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 18082 observations read from the data set WORK.PROJECT3_F17.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: The data set WORK.PROJECT3_F17 has 18082 observations and 3 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.15 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.01 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 18082 observations read from the data set WORK.PROJECT3_F17.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 4.96 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 3.20 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;17 ***2.REORGANIZE variables: USE ARRAY STATEMENT ALONG WITH FIRST.ID and LAST.ID;&lt;BR /&gt;18 data sympt (drop=symptom_no symptom);&lt;BR /&gt;19 set PROJECT3_F17;&lt;BR /&gt;20 retain sympt1-sympt5;&lt;BR /&gt;21 length sympt1-sympt5 $15;&lt;BR /&gt;22 array symptoms (5) $15. sympt1-sympt5;&lt;BR /&gt;23 by id_no;&lt;BR /&gt;24 if first.id_no then call missing(of symptoms(*));&lt;BR /&gt;25 symptoms(symptom_no)=symptom;&lt;BR /&gt;26 if last.id_no then output;&lt;BR /&gt;27 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 18082 observations read from the data set WORK.PROJECT3_F17.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: The data set WORK.SYMPT has 12549 observations and 6 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.66 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.07 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;28 proc print data=sympt;&lt;BR /&gt;29 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 12549 observations read from the data set WORK.SYMPT.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 3.42 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 3.34 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;30 ***3.Set disease=1 if sympt1+sympt2+sympt3 and no sympt4-sympt5 WORK OFF DATA SET SYMPT;&lt;/STRONG&gt;&lt;BR /&gt;31 data dis_01 (drop=answer);&lt;BR /&gt;32 set sympt;&lt;BR /&gt;33 retain disease;&lt;BR /&gt;34 array dpthdisease (1) disease;&lt;BR /&gt;35 by id_no;&lt;BR /&gt;36 if first.id_no then dpthdisease (symp1-sympt5)=answer;&lt;BR /&gt;37 If answer EQ sympt1-sympt3 and NE sympt4 OR sympt5 then disease=1;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;22&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, -, /, &amp;lt;, &amp;lt;=,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&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, [,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;^=, {, |, ||, ~=.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;38 else disease=0;&lt;BR /&gt;39 if last.id_no then output;&lt;BR /&gt;40 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;(Line):(Column).&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;36:44 37:18 37:25 37:39 37:49&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;WARNING: The data set WORK.DIS_01 may be incomplete. When this step was stopped there were 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;observations and 9 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.23 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.04 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;53 proc print data=dis_01;&lt;BR /&gt;54 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: No observations in data set WORK.DIS_01.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.00 seconds&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 18:54:37 GMT</pubDate>
    <dc:creator>aespinarey</dc:creator>
    <dc:date>2018-02-13T18:54:37Z</dc:date>
    <item>
      <title>Creating new variable and formulating its value to depend on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-and-formulating-its-value-to-depend-on/m-p/436809#M108687</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I am having trouble creating a new variable "&lt;STRONG&gt;disease&lt;/STRONG&gt;" that would determine whether or not the subject has the disease &lt;STRONG&gt;(1)&lt;/STRONG&gt; or does not &lt;STRONG&gt;(0)&lt;/STRONG&gt;, depending on the symptoms listed on 5 different variables. If patient has sympt1-sympt3 (heartburns, sickness, and spasm) without sympt4 and/or sympt5 (temperature and/ or tiredness), then patient has disease (1). If the conditions are any different then disease should equal 0.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="project3 task2 table.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18499i4FF11C2DC6FB40EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="project3 task2 table.PNG" alt="project3 task2 table.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;CODE:&lt;/P&gt;&lt;P&gt;options nodate nonumber;&lt;BR /&gt;****1.IMPORT;&lt;BR /&gt;%macro P3 (a, b, c, d);&lt;BR /&gt;proc import out= &amp;amp;a&lt;BR /&gt;datafile= "C:\HW5\&amp;amp;b"&lt;BR /&gt;dbms=xlsx replace;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=&amp;amp;a;&lt;BR /&gt;by &amp;amp;c &amp;amp;d;&lt;BR /&gt;run;&lt;BR /&gt;Proc print data = &amp;amp;a;&lt;BR /&gt;Run;&lt;BR /&gt;%mend P3;&lt;/P&gt;&lt;P&gt;%P3 (PROJECT3_F17, Project3.xlsx, id_no, symptom_no);&lt;BR /&gt;***2.REORGANIZE variables: USE ARRAY STATEMENT ALONG WITH FIRST.ID and LAST.ID;&lt;BR /&gt;data sympt (drop=symptom_no symptom);&lt;BR /&gt;set PROJECT3_F17;&lt;BR /&gt;retain sympt1-sympt5;&lt;BR /&gt;length sympt1-sympt5 $15;&lt;BR /&gt;array symptoms (5) $15. sympt1-sympt5;&lt;BR /&gt;by id_no;&lt;BR /&gt;if first.id_no then call missing(of symptoms(*));&lt;BR /&gt;symptoms(symptom_no)=symptom;&lt;BR /&gt;if last.id_no then output;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=sympt;&lt;BR /&gt;run;&lt;BR /&gt;&lt;STRONG&gt;***3.Set disease=1 if sympt1+sympt2+sympt3 and no sympt4-sympt5 WORK OFF DATA SET SYMPT;&lt;/STRONG&gt;&lt;BR /&gt;data dis_01 (drop=answer);&lt;BR /&gt;set sympt;&lt;BR /&gt;retain disease;&lt;BR /&gt;array dpthdisease (1) disease;&lt;BR /&gt;by id_no;&lt;BR /&gt;if first.id_no then dpthdisease (symp1-sympt5)=answer;&lt;BR /&gt;If answer EQ sympt1-sympt3 and NE sympt4 OR sympt5 then disease=1;&lt;BR /&gt;else disease=0;&lt;BR /&gt;if last.id_no then output;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=disease;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;LOG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 options nodate nonumber;&lt;BR /&gt;2 ****1.IMPORT;&lt;BR /&gt;3 %macro P3 (a, b, c, d);&lt;BR /&gt;4 proc import out= &amp;amp;a&lt;BR /&gt;5 datafile= "C:\HW5\&amp;amp;b"&lt;BR /&gt;6 dbms=xlsx replace;&lt;BR /&gt;7 getnames=yes;&lt;BR /&gt;8 run;&lt;BR /&gt;9 proc sort data=&amp;amp;a;&lt;BR /&gt;10 by &amp;amp;c &amp;amp;d;&lt;BR /&gt;11 run;&lt;BR /&gt;12 Proc print data = &amp;amp;a;&lt;BR /&gt;13 Run;&lt;BR /&gt;14 %mend P3;&lt;BR /&gt;15&lt;BR /&gt;16 %P3 (PROJECT3_F17, Project3.xlsx, id_no, symptom_no);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: The import data set has 18082 observations and 3 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: WORK.PROJECT3_F17 data set was successfully created.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 1.41 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.85 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 18082 observations read from the data set WORK.PROJECT3_F17.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: The data set WORK.PROJECT3_F17 has 18082 observations and 3 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.15 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.01 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 18082 observations read from the data set WORK.PROJECT3_F17.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 4.96 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 3.20 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;17 ***2.REORGANIZE variables: USE ARRAY STATEMENT ALONG WITH FIRST.ID and LAST.ID;&lt;BR /&gt;18 data sympt (drop=symptom_no symptom);&lt;BR /&gt;19 set PROJECT3_F17;&lt;BR /&gt;20 retain sympt1-sympt5;&lt;BR /&gt;21 length sympt1-sympt5 $15;&lt;BR /&gt;22 array symptoms (5) $15. sympt1-sympt5;&lt;BR /&gt;23 by id_no;&lt;BR /&gt;24 if first.id_no then call missing(of symptoms(*));&lt;BR /&gt;25 symptoms(symptom_no)=symptom;&lt;BR /&gt;26 if last.id_no then output;&lt;BR /&gt;27 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 18082 observations read from the data set WORK.PROJECT3_F17.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: The data set WORK.SYMPT has 12549 observations and 6 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.66 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.07 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;28 proc print data=sympt;&lt;BR /&gt;29 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: There were 12549 observations read from the data set WORK.SYMPT.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 3.42 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 3.34 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;30 ***3.Set disease=1 if sympt1+sympt2+sympt3 and no sympt4-sympt5 WORK OFF DATA SET SYMPT;&lt;/STRONG&gt;&lt;BR /&gt;31 data dis_01 (drop=answer);&lt;BR /&gt;32 set sympt;&lt;BR /&gt;33 retain disease;&lt;BR /&gt;34 array dpthdisease (1) disease;&lt;BR /&gt;35 by id_no;&lt;BR /&gt;36 if first.id_no then dpthdisease (symp1-sympt5)=answer;&lt;BR /&gt;37 If answer EQ sympt1-sympt3 and NE sympt4 OR sympt5 then disease=1;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;22&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, -, /, &amp;lt;, &amp;lt;=,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&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, [,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;^=, {, |, ||, ~=.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;38 else disease=0;&lt;BR /&gt;39 if last.id_no then output;&lt;BR /&gt;40 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;(Line):(Column).&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;36:44 37:18 37:25 37:39 37:49&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;WARNING: The data set WORK.DIS_01 may be incomplete. When this step was stopped there were 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;observations and 9 variables.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.23 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.04 seconds&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;53 proc print data=dis_01;&lt;BR /&gt;54 run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: No observations in data set WORK.DIS_01.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;real time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;cpu time 0.00 seconds&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 18:54:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-and-formulating-its-value-to-depend-on/m-p/436809#M108687</guid>
      <dc:creator>aespinarey</dc:creator>
      <dc:date>2018-02-13T18:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable and formulating its value to depend on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-and-formulating-its-value-to-depend-on/m-p/436823#M108691</link>
      <description>&lt;P&gt;Is this for a course? This exact question with the same data has been asked and answered on here.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 19:29:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-and-formulating-its-value-to-depend-on/m-p/436823#M108691</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-13T19:29:45Z</dc:date>
    </item>
  </channel>
</rss>

