<?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: Creating variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables/m-p/201082#M50191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked!! Oh ballardw, thank you so much. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Jun 2015 17:17:02 GMT</pubDate>
    <dc:creator>gros0265</dc:creator>
    <dc:date>2015-06-09T17:17:02Z</dc:date>
    <item>
      <title>Creating variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables/m-p/201080#M50189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;I'm using&lt;SPAN class="apple-converted-space"&gt; &lt;/SPAN&gt;SAS version 9.4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;I have very limited experience using SAS so there might be a really easy answer here, but bear with me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;I have a dataset with 1431 observations and 78 variables. In question are 15 variables with responses of 1, 2, 3, or 9. I would like to create a new variable called MDR that meets the following criteria:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;If at least 3 of the 15 variables have a response of 2 or 3, then MDR=1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Or if creating a new variable is what's hampering me, if there is a way to just keep those with the aforementioned criteria, that would be fine. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;All I can think to do is write a seemingly endless if-then-else statement…basically doing by hand what I have to assume SAS could do on its own if I knew the correct code or procedure to use!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Can you help?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Thank you!!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2015 16:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-variables/m-p/201080#M50189</guid>
      <dc:creator>gros0265</dc:creator>
      <dc:date>2015-06-09T16:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables/m-p/201081#M50190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I call programmers trick #27 might help. The "trick" is based on when SAS does a logical comparison it returns 0 for false and 1 for true. So you can add, or sum them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sum(var1 in (2,3),var2 in (2,3),var3 in (2,3),var4 in (2,3),var5 in (2,3) &amp;lt;continue in the obvious fashion&amp;gt;) ge 3 then MDR=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;MDR = (sum(var1 in (2,3),var2 in (2,3),var3 in (2,3),var4 in (2,3),var5 in (2,3) &amp;lt;continue in the obvious fashion&amp;gt;) ge 3); will create a 1/0 value&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2015 16:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-variables/m-p/201081#M50190</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-09T16:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables/m-p/201082#M50191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked!! Oh ballardw, thank you so much. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2015 17:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-variables/m-p/201082#M50191</guid>
      <dc:creator>gros0265</dc:creator>
      <dc:date>2015-06-09T17:17:02Z</dc:date>
    </item>
  </channel>
</rss>

