<?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: Using array to create variables with multiple categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509269#M136891</link>
    <description>&lt;P&gt;less than 2 = no disorder; 2 to 3 = mild disorder; 4 or more = moderate/severe&lt;/P&gt;</description>
    <pubDate>Wed, 31 Oct 2018 19:04:51 GMT</pubDate>
    <dc:creator>kgrover</dc:creator>
    <dc:date>2018-10-31T19:04:51Z</dc:date>
    <item>
      <title>Using array to create variables with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509261#M136889</link>
      <description>&lt;P&gt;I have used the following code to define use disorder if 2 or more questions are answered as yes. This statement works for this purpose.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data mergeTOB2; set mergeTOB1;&lt;BR /&gt;array num{*} CIINTERF--CIPROBLM;&lt;BR /&gt;TOBDORD = sum (of num(*)) ge 2;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i modify this statement to define mild and moderate disorder, where sum of ge 2 but lt 3 is mild and ge 4 is moderate?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 18:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509261#M136889</guid>
      <dc:creator>kgrover</dc:creator>
      <dc:date>2018-10-31T18:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using array to create variables with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509267#M136890</link>
      <description>&lt;P&gt;So it can be only mild and moderate, or?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509267#M136890</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-10-31T19:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using array to create variables with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509269#M136891</link>
      <description>&lt;P&gt;less than 2 = no disorder; 2 to 3 = mild disorder; 4 or more = moderate/severe&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509269#M136891</guid>
      <dc:creator>kgrover</dc:creator>
      <dc:date>2018-10-31T19:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using array to create variables with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509316#M136909</link>
      <description>&lt;P&gt;Maybe in SQL you could assign three different values with a single CASE statement.&amp;nbsp; But in a DATA step you will need two variables:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data mergeTOB2;&lt;/P&gt;
&lt;P&gt;set merge TOB;&lt;/P&gt;
&lt;P&gt;array num {*} CIINTERF--CIPROBLM;&lt;/P&gt;
&lt;P&gt;TOBDORD = sum(of num{*});&lt;/P&gt;
&lt;P&gt;if tobdord &amp;gt;= 4 then result = "moderate/severe";&lt;/P&gt;
&lt;P&gt;else if tobord = 3 then result = "mild";&lt;/P&gt;
&lt;P&gt;else result = "no disorder";&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could consider dropping TOBORD once RESULT is created.&amp;nbsp; Alternatively, you could skip creating RESULT entirely and just let TOBORD be your new variable.&amp;nbsp; When it comes time to print, you could add a format that translates numeric values into descriptive strings, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;/P&gt;
&lt;P&gt;value result low-2 = "no disorder"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 3 = "mild"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 4-high = "moderate/severe";&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another variation:&amp;nbsp; it's not clear if you want to get rid of the observations with counts of 2 or less.&amp;nbsp; The last ELSE statement could become (if needed):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;else delete;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 20:25:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-array-to-create-variables-with-multiple-categories/m-p/509316#M136909</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-31T20:25:02Z</dc:date>
    </item>
  </channel>
</rss>

