<?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: how do i do this with as few steps as possible? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331152#M74381</link>
    <description>&lt;P&gt;sum(of diag1-diag9) &amp;gt;=1 OR max(of diag1-diag9) &amp;gt;=1 should work.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2017 14:00:05 GMT</pubDate>
    <dc:creator>Vish33</dc:creator>
    <dc:date>2017-02-09T14:00:05Z</dc:date>
    <item>
      <title>how do i do this with as few steps as possible?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331134#M74373</link>
      <description>&lt;P&gt;&amp;nbsp;i have a database that looks like this&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;id&lt;/TD&gt;&lt;TD&gt;diag 1&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;diag2&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;diag3&lt;/TD&gt;&lt;TD&gt;diag4&lt;/TD&gt;&lt;TD&gt;diag5&lt;/TD&gt;&lt;TD&gt;diag7&lt;/TD&gt;&lt;TD&gt;diag8&lt;/TD&gt;&lt;TD&gt;diag9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a new_var that is equals to 1 if either one of the 'diag's &amp;nbsp;have a value of 1.&lt;/P&gt;&lt;P&gt;I did it by summing the diags and having the new_var = 1 if sum(diag1-diag24)&amp;gt;=1.&lt;/P&gt;&lt;P&gt;Is there another way to do this without typing a lot? Also, my technique only works if the observantions are 1s and 0s. I could do something like this if my obs values were different than 1 --&amp;gt; diag1=2 or diag2=1 or diag3=5....and so on then new_var=1. This isn't very practical when i have many 'diag's, so how could I do this without typing a lot?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 12:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331134#M74373</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2017-02-09T12:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: how do i do this with as few steps as possible?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331135#M74374</link>
      <description>&lt;P&gt;I think your solution is solid, though you would probably type&amp;nbsp;&lt;SPAN&gt;sum(of diag1-diag24)&amp;gt;=1 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 12:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331135#M74374</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-02-09T12:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: how do i do this with as few steps as possible?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331136#M74375</link>
      <description>&lt;P&gt;good catch! thanks &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 12:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331136#M74375</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2017-02-09T12:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: how do i do this with as few steps as possible?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331140#M74377</link>
      <description>&lt;P&gt;Finding only a 1 (not a 2 or a 5) can be done with only mild complications. &amp;nbsp;The CAT family of functions works on numeric as well as character values. &amp;nbsp;So you could code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if index(cats(of diag1-diag24), '1') &amp;gt; 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data contains two-digit numbers (so you need to find "1" but not "10"), it can still be done but gets mildly more complex.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 13:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331140#M74377</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-09T13:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: how do i do this with as few steps as possible?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331152#M74381</link>
      <description>&lt;P&gt;sum(of diag1-diag9) &amp;gt;=1 OR max(of diag1-diag9) &amp;gt;=1 should work.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 14:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331152#M74381</guid>
      <dc:creator>Vish33</dc:creator>
      <dc:date>2017-02-09T14:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: how do i do this with as few steps as possible?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331215#M74409</link>
      <description>&lt;P&gt;For a very few character shorter typing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;new_var = (index(catt(of diag:),&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'1'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;)&amp;gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;0&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 16:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-do-this-with-as-few-steps-as-possible/m-p/331215#M74409</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-09T16:14:37Z</dc:date>
    </item>
  </channel>
</rss>

