<?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: Selecting multiple numerical values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285899#M58559</link>
    <description>&lt;P&gt;Reeza, you're my hero! It worked after I removed the equal sign and quotation marks.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2016 17:24:45 GMT</pubDate>
    <dc:creator>rogersaj</dc:creator>
    <dc:date>2016-07-20T17:24:45Z</dc:date>
    <item>
      <title>Selecting multiple numerical values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285891#M58555</link>
      <description>&lt;P&gt;I'm sure there's a simple answer to this, but how do I specify several numerical values that I'm interested in?&lt;/P&gt;&lt;P&gt;For example, for variable "hivstatus" I want to select values 0,1,2 to mark those as "Known HIV status."&lt;/P&gt;&lt;P&gt;I tried this but it didn't work:&lt;/P&gt;&lt;P&gt;if hivstatus = in('0','1','2') then &amp;nbsp;status = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, how do I select the opposite (ie, NOT 0,1,2)?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285891#M58555</guid>
      <dc:creator>rogersaj</dc:creator>
      <dc:date>2016-07-20T17:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple numerical values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285895#M58558</link>
      <description>&lt;P&gt;Your code:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if hivstatus = in('0','1','2') then &amp;nbsp;status = 1;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SAS Code, assuming character variables. If this is numeric variable you don't need the quotation marks.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if hivstatus IN ('0','1','2') then  status = 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;The corrresponding NOT would be:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if hivstatus NOT IN ('0','1','2') then  status = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: You've said numeric variables so the code should be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if hivstatus IN ( 0, 1,  2 ) then  status = 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:21:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285895#M58558</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-20T17:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple numerical values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285899#M58559</link>
      <description>&lt;P&gt;Reeza, you're my hero! It worked after I removed the equal sign and quotation marks.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285899#M58559</guid>
      <dc:creator>rogersaj</dc:creator>
      <dc:date>2016-07-20T17:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple numerical values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285909#M58561</link>
      <description>&lt;P&gt;An alternate approach for some purposes could be to use a custom format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value HIVStatus
0,1,2 = 'Text description'
3,4   = 'Other text'
.     = 'Missing'
;

proc freq data=have;
   tables HIVstatus;
   format HIVstatus HIVStatus. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Would display the frequency table with the text assigned by the Format HIVStatus. This is a useful tool as you can apply different display values just by changing the format for a specific report procedure. For example you could have a long and short version of text for the individual or groups of codes or create different groups entirely. Many of the analysis and graphing procedures will honor the formatted value. So you don't have to add a new variable when wanting to use a new assignment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-multiple-numerical-values/m-p/285909#M58561</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-20T17:41:51Z</dc:date>
    </item>
  </channel>
</rss>

