<?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 a range of variables in an &amp;quot;IF&amp;quot; statement in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-a-range-of-variables-in-an-quot-IF-quot-statement/m-p/81329#M23442</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, data_null, this is helpful.&amp;nbsp; It will return the ordered number of the first variable it hits, correct?&amp;nbsp; So if my data row were to look like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T1 T2 T3 T4&lt;/P&gt;&lt;P&gt;8&amp;nbsp;&amp;nbsp; 9&amp;nbsp; 10&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;has1 = whichN(9, of T1-T4)&lt;/P&gt;&lt;P&gt;would return has1=2 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could work, because then I would just need to add a line of code if has1 &amp;gt; 0 then has1=1.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;-Katie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jul 2013 18:29:41 GMT</pubDate>
    <dc:creator>kathryn_jackson1_northwestern_edu</dc:creator>
    <dc:date>2013-07-16T18:29:41Z</dc:date>
    <item>
      <title>Using a range of variables in an "IF" statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-a-range-of-variables-in-an-quot-IF-quot-statement/m-p/81327#M23440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create indicator variables, based on information in other variables in my table.&amp;nbsp; I have a data set in wide format (which I created from long) that has subject data at many (up to 700) different timepoints.&amp;nbsp; Basically, if ANY of those time points have a specific value, I'd like to create an indicator.&amp;nbsp; For example, if any of T1-T100 = 1, then I want INDICATOR=1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I have SAS specify a range of variable to check in my IF statement?&amp;nbsp; I know I can us multiple "or" statements, but this is not practical, given the large number of time points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I considered writing it into my array when I converted from long to wide format, but this did not seem to work and I did not see documentation on this particular issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I tried..&lt;/P&gt;&lt;P&gt;data wide (keep=id T1-T&amp;amp;mm var1-var&amp;amp;mm);&lt;/P&gt;&lt;P&gt;array T(&amp;amp;mm);&lt;/P&gt;&lt;P&gt;array var(&amp;amp;mm);&lt;/P&gt;&lt;P&gt;do j = 1 by 1 until (last.id);&lt;/P&gt;&lt;P&gt; set data1;&lt;/P&gt;&lt;P&gt; by id;&lt;/P&gt;&lt;P&gt; T(j) = Time;&lt;/P&gt;&lt;P&gt; var(j) = score;&lt;/P&gt;&lt;P&gt; if var(j) = 20 then HIGH = 1; else HIGH=0;&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;-Katie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 17:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-a-range-of-variables-in-an-quot-IF-quot-statement/m-p/81327#M23440</guid>
      <dc:creator>kathryn_jackson1_northwestern_edu</dc:creator>
      <dc:date>2013-07-16T17:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using a range of variables in an "IF" statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-a-range-of-variables-in-an-quot-IF-quot-statement/m-p/81328#M23441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think WHICHN will be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;has1 = whichN(1,of T1-T100);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if has1 is greater than 1 then the range contains a least 1 variable with the target.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 17:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-a-range-of-variables-in-an-quot-IF-quot-statement/m-p/81328#M23441</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-07-16T17:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using a range of variables in an "IF" statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-a-range-of-variables-in-an-quot-IF-quot-statement/m-p/81329#M23442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, data_null, this is helpful.&amp;nbsp; It will return the ordered number of the first variable it hits, correct?&amp;nbsp; So if my data row were to look like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T1 T2 T3 T4&lt;/P&gt;&lt;P&gt;8&amp;nbsp;&amp;nbsp; 9&amp;nbsp; 10&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;has1 = whichN(9, of T1-T4)&lt;/P&gt;&lt;P&gt;would return has1=2 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could work, because then I would just need to add a line of code if has1 &amp;gt; 0 then has1=1.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;-Katie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 18:29:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-a-range-of-variables-in-an-quot-IF-quot-statement/m-p/81329#M23442</guid>
      <dc:creator>kathryn_jackson1_northwestern_edu</dc:creator>
      <dc:date>2013-07-16T18:29:41Z</dc:date>
    </item>
  </channel>
</rss>

