<?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 IF Then Recognising Character Observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418797#M102905</link>
    <description>&lt;P&gt;My research involves analysing health diagnoses&amp;nbsp;by ethnicity.&lt;/P&gt;&lt;P&gt;The diagnoses are coded via a classification code and I am attempting to create diagnostic groups through the if and then statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Most of the code for the groups are working all except&amp;nbsp;a portion which unlike the other&amp;nbsp;diagnostic groups contain characters&amp;nbsp;as part of the classification code. i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;other=0;&lt;BR /&gt;if clincode='293.89'&lt;BR /&gt;or clincode='310.1'&lt;BR /&gt;or clincode='293.9'&lt;BR /&gt;or clincode='316'&lt;BR /&gt;or clincode='3321'&lt;BR /&gt;or clincode='33392'&lt;BR /&gt;or clincode='3337'&lt;BR /&gt;or clincode='33399'&lt;BR /&gt;or clincode='33382'&lt;BR /&gt;or clincode='3331'&lt;BR /&gt;or clincode='33390'&lt;BR /&gt;or clincode='9952'&lt;BR /&gt;or clincode='v619'&lt;BR /&gt;or clincode='v6120'&lt;BR /&gt;or clincode='v6110'&lt;BR /&gt;or clincode='v618'&lt;BR /&gt;or clincode='v6181'&lt;BR /&gt;or clincode='v6121'&lt;BR /&gt;or clincode='v6112'&lt;BR /&gt;or clincode='v6283'&lt;BR /&gt;or clincode='v1581'&lt;BR /&gt;or clincode='v652'&lt;BR /&gt;or clincode='v7101'&lt;BR /&gt;or clincode='v7102'&lt;BR /&gt;or clincode='v6289'&lt;BR /&gt;or clincode='7809'&lt;BR /&gt;or clincode='v6282'&lt;BR /&gt;or clincode='v623'&lt;BR /&gt;or clincode='v622'&lt;BR /&gt;or clincode='31382'&lt;BR /&gt;or clincode='v6289'&lt;BR /&gt;or clincode='v624'&lt;BR /&gt;or clincode='3009'&lt;BR /&gt;or clincode='v7109'&lt;BR /&gt;or clincode='7999' then other=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the diagnostic group with classification codes containing only numerals work. Is SAS not able to read in the&amp;nbsp;characters compared to codes with just numerals? If not is there a way in which I can get it to recognize the mixed character and numerical observations?&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2017 14:12:08 GMT</pubDate>
    <dc:creator>acelini</dc:creator>
    <dc:date>2017-12-06T14:12:08Z</dc:date>
    <item>
      <title>IF Then Recognising Character Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418797#M102905</link>
      <description>&lt;P&gt;My research involves analysing health diagnoses&amp;nbsp;by ethnicity.&lt;/P&gt;&lt;P&gt;The diagnoses are coded via a classification code and I am attempting to create diagnostic groups through the if and then statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Most of the code for the groups are working all except&amp;nbsp;a portion which unlike the other&amp;nbsp;diagnostic groups contain characters&amp;nbsp;as part of the classification code. i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;other=0;&lt;BR /&gt;if clincode='293.89'&lt;BR /&gt;or clincode='310.1'&lt;BR /&gt;or clincode='293.9'&lt;BR /&gt;or clincode='316'&lt;BR /&gt;or clincode='3321'&lt;BR /&gt;or clincode='33392'&lt;BR /&gt;or clincode='3337'&lt;BR /&gt;or clincode='33399'&lt;BR /&gt;or clincode='33382'&lt;BR /&gt;or clincode='3331'&lt;BR /&gt;or clincode='33390'&lt;BR /&gt;or clincode='9952'&lt;BR /&gt;or clincode='v619'&lt;BR /&gt;or clincode='v6120'&lt;BR /&gt;or clincode='v6110'&lt;BR /&gt;or clincode='v618'&lt;BR /&gt;or clincode='v6181'&lt;BR /&gt;or clincode='v6121'&lt;BR /&gt;or clincode='v6112'&lt;BR /&gt;or clincode='v6283'&lt;BR /&gt;or clincode='v1581'&lt;BR /&gt;or clincode='v652'&lt;BR /&gt;or clincode='v7101'&lt;BR /&gt;or clincode='v7102'&lt;BR /&gt;or clincode='v6289'&lt;BR /&gt;or clincode='7809'&lt;BR /&gt;or clincode='v6282'&lt;BR /&gt;or clincode='v623'&lt;BR /&gt;or clincode='v622'&lt;BR /&gt;or clincode='31382'&lt;BR /&gt;or clincode='v6289'&lt;BR /&gt;or clincode='v624'&lt;BR /&gt;or clincode='3009'&lt;BR /&gt;or clincode='v7109'&lt;BR /&gt;or clincode='7999' then other=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the diagnostic group with classification codes containing only numerals work. Is SAS not able to read in the&amp;nbsp;characters compared to codes with just numerals? If not is there a way in which I can get it to recognize the mixed character and numerical observations?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 14:12:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418797#M102905</guid>
      <dc:creator>acelini</dc:creator>
      <dc:date>2017-12-06T14:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: IF Then Recognising Character Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418798#M102906</link>
      <description>&lt;P&gt;SAS has no trouble recognizing&amp;nbsp;characters.&amp;nbsp; But it does require an exact match.&amp;nbsp; For example, is it possible you need to use an uppercase "V" in your statement?&amp;nbsp; "v619" is different from "V619".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data has a mix of upper and lower case, you might want to use upcase(clincode) in your statement, so you don't need to list the lower case versions.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 14:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418798#M102906</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-06T14:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF Then Recognising Character Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418804#M102910</link>
      <description>&lt;P&gt;I recommend using an informat instead of that very long and hardly maintainable if-construct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
   invalue cc_marker / upcase
   'v6282'
   , 'v623'
   , 'v622'
   , '31382'
   , 'v6289'
   , 'v624'
   , '3009'
   , 'v7109' = 1
   other = 0
   ;
run;

data work.have;
   length clincode $ 6;
   
   input clincode;
   
   other = input(clincode, cc_marker.);
   
   datalines;
v3434
V6289
v624
v8888
3009
v7109
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2017 14:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418804#M102910</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2017-12-06T14:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: IF Then Recognising Character Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418805#M102911</link>
      <description>&lt;P&gt;Do those codes you provide come in a usable format, i.e. do you have them or can get them into a dataset?&amp;nbsp; If so then a simple merge of that data on your data would simplify your code.&amp;nbsp; Alternatively you could create format from the codes, and apply the format to the data to get the same result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One other thing, you need not do loads of or statements, you can simplify to:&lt;/P&gt;
&lt;PRE&gt;if clincode in ('293.89','310.1',...) then other=1;&lt;/PRE&gt;
&lt;P&gt;You could even say the below to do it in one step.&lt;/P&gt;
&lt;PRE&gt;other=ifn(clincode in ('293.89','310.1'...),1,0);&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2017 14:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418805#M102911</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-12-06T14:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: IF Then Recognising Character Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418820#M102920</link>
      <description>&lt;P&gt;I agree, a format is the way to go especially if OP can get the target codes into a dataset. Additionally, OP should ensure the source format matches the target format. In particular, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;mentioned, convert to&amp;nbsp;upcase and also strip "." from the codes if there are no "."s in the target data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 15:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/418820#M102920</guid>
      <dc:creator>bstarr</dc:creator>
      <dc:date>2017-12-06T15:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: IF Then Recognising Character Observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/419484#M103158</link>
      <description>&lt;P&gt;Yes, I thought that there had to be an easier way to do this.&lt;/P&gt;&lt;P&gt;Thanks for the tip.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will most definitely be using it in the future.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 07:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Then-Recognising-Character-Observations/m-p/419484#M103158</guid>
      <dc:creator>acelini</dc:creator>
      <dc:date>2017-12-08T07:59:59Z</dc:date>
    </item>
  </channel>
</rss>

