<?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: Array and If/Then in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416154#M280224</link>
    <description>&lt;P&gt;Your class mate has already asked this question. Very similar subject line so your search should be easy. It has a fully worked solution.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Nov 2017 18:46:32 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-11-25T18:46:32Z</dc:date>
    <item>
      <title>Array and If/Then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416153#M280223</link>
      <description>&lt;P&gt;I have a dataset with 12,000 some variables and I need to collapse them so that there are no repeats with ID number and the symptoms are described on one line. The data I am working with looks like this:&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2017-11-25 at 1.18.55 PM.png" style="width: 462px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16849i78276009CD6ABCC0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-11-25 at 1.18.55 PM.png" alt="Screen Shot 2017-11-25 at 1.18.55 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And I am trying to get it to look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2017-11-25 at 1.21.29 PM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16850i6BE798287C57DC05/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-11-25 at 1.21.29 PM.png" alt="Screen Shot 2017-11-25 at 1.21.29 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The data is from excel so I imported it and have come up with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data= project3;
	by id_no;
run;
&lt;BR /&gt;*need array to identify symptoms&lt;BR /&gt;*symptom 1=heartburn, symptom 2=sickness, symptom 3=spasm, symptom 4=temperature, symptom 5=tiredness&lt;BR /&gt;*if/then statement&lt;BR /&gt;*dont want to keep symptom_no and symptom, instead make new variable;&lt;BR /&gt;
data want;
	array symptoms[5] symptom_no1-symptom_no5; *I named the arrays symptom instead of sympt to create the new variables;
	retain symptom_no1-symptom_no5;
	set project3;
by id_no;
if first.id_no then do i=1 to 5; *this allowed me to not have any duplicates for the ID_no;
				symptoms[i]=.;
			end;
		if last.id_no then output;
keep id_no symptom_no1-symptom_no5;
run;

proc print data=want;
	var id_no symptom_no1-symptom_no5;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Unfortunately, when I run this, nothing is populated for symptoms and I end up getting this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2017-11-25 at 1.29.16 PM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16851i040D1CF2BC829023/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-11-25 at 1.29.16 PM.png" alt="Screen Shot 2017-11-25 at 1.29.16 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that I have to define the symptoms such that when the system reads it knows symptom 1 is heartburns, 2 is sickness, 3=spasm, 4=temperature, 5=tiredness. I'm guessing this should go prior to the symptom array I've already written, but am having a hard time. Could I get some direction/advice please?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="grammarly-disable-indicator"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="grammarly-disable-indicator"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sat, 25 Nov 2017 18:34:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416153#M280223</guid>
      <dc:creator>savanahb</dc:creator>
      <dc:date>2017-11-25T18:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Array and If/Then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416154#M280224</link>
      <description>&lt;P&gt;Your class mate has already asked this question. Very similar subject line so your search should be easy. It has a fully worked solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2017 18:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416154#M280224</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-25T18:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Array and If/Then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416156#M280225</link>
      <description>&lt;P&gt;Thank you. I was able to find it, I think.&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Using-IF-THEN-ELSE-statements-to-create-a-flag-indicating/m-p/416079/highlight/true#M102150" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/Using-IF-THEN-ELSE-statements-to-create-a-flag-indicating/m-p/416079/highlight/true#M102150&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2017 18:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416156#M280225</guid>
      <dc:creator>savanahb</dc:creator>
      <dc:date>2017-11-25T18:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Array and If/Then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416168#M280226</link>
      <description>&lt;P&gt;She asked three questions related to it I believe.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find her posts by clicking on her name.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2017 21:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416168#M280226</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-25T21:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Array and If/Then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416171#M280227</link>
      <description>&lt;P&gt;What are the other 11,997 variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your example input only shows 3 variables. And two of those are showing the same information in different ways.&amp;nbsp; When SYMPTOM_NO=1 then SYMPTOM is always "Heartburns".&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2017 23:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-and-If-Then/m-p/416171#M280227</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-25T23:49:28Z</dc:date>
    </item>
  </channel>
</rss>

