<?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: If then (or something else) to encompass all responses not specified into a single response in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-then-or-something-else-to-encompass-all-responses-not/m-p/847685#M335135</link>
    <description>&lt;P&gt;Why even bother formatting a meaningful value like an area code to a non-meaningful number like 1 or 2 or 3? This is not necessary and not helpful to your coding or to the usage of the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
    set one;
    if phonenumber not in (123 456 789) then areacode=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, the area codes remain understandable, rather than the meaningless 1 or 2 or 3. You can even assign a format to change the missing to "Out of State".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which brings me to a question ... do you really want to do this logic on variable PHONENUMBER or should you be doing this logic on variable AREACODE? Have you mixed up the variable names? Seems to me you've got the wrong variable, you want to do this on AREACODE and not PHONENUMBER ... or at least you have the wrong variable name given the values it contains.&lt;/P&gt;</description>
    <pubDate>Sun, 04 Dec 2022 23:20:32 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-12-04T23:20:32Z</dc:date>
    <item>
      <title>If then (or something else) to encompass all responses not specified into a single response</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-or-something-else-to-encompass-all-responses-not/m-p/847683#M335133</link>
      <description>&lt;P&gt;Sorry, I am pretty new to SAS and I am not sure how to explain my problem very well. I have a phone number variable and I have extracted the area code out. My state has three area codes, but we have responses from phone numbers all over the US. So, I would like to label the three area codes from my state 1, 2, and 3 from the value below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I get to the if then statement, I would like to write a line that would basically state: If the area code does not equal (123, 456, 789) code as value 4 (Out of State). Could someone please help me with this? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;value areacode 1='123'&lt;BR /&gt;2='456'&lt;BR /&gt;3='789'&lt;BR /&gt;4='Out of State';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if 123 = PhoneNumber then areacode = 1;&lt;BR /&gt;else if 456 = PhoneNumber then areacode = 2;&lt;BR /&gt;else if 789 = PhoneNumber then areacode = 3;&lt;BR /&gt;else areacode = 4;&lt;BR /&gt;else areacode=.;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2022 22:56:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-or-something-else-to-encompass-all-responses-not/m-p/847683#M335133</guid>
      <dc:creator>bej</dc:creator>
      <dc:date>2022-12-04T22:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: If then (or something else) to encompass all responses not specified into a single response</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-or-something-else-to-encompass-all-responses-not/m-p/847685#M335135</link>
      <description>&lt;P&gt;Why even bother formatting a meaningful value like an area code to a non-meaningful number like 1 or 2 or 3? This is not necessary and not helpful to your coding or to the usage of the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
    set one;
    if phonenumber not in (123 456 789) then areacode=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, the area codes remain understandable, rather than the meaningless 1 or 2 or 3. You can even assign a format to change the missing to "Out of State".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which brings me to a question ... do you really want to do this logic on variable PHONENUMBER or should you be doing this logic on variable AREACODE? Have you mixed up the variable names? Seems to me you've got the wrong variable, you want to do this on AREACODE and not PHONENUMBER ... or at least you have the wrong variable name given the values it contains.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2022 23:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-or-something-else-to-encompass-all-responses-not/m-p/847685#M335135</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-04T23:20:32Z</dc:date>
    </item>
  </channel>
</rss>

