<?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 categorize a new variable disregarding a decimal? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-categorize-a-new-variable-disregarding-a-decimal/m-p/698218#M25488</link>
    <description>&lt;P&gt;ICD10 code are character strings (ICD9 codes should be characters strings also).&lt;/P&gt;
&lt;P&gt;So use the : modifier on your comparison operators to do truncated comparisons.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if missing(ICD10) then CODCd = .;
else if ICD10 =: 'I25' then CODCd = 1;
else if ICD10 =: 'I50' then CODCd = 2;
else if ICD10 =: 'I63' then CODCd = 3;
else CodCd = 4;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 11 Nov 2020 20:01:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-11-11T20:01:25Z</dc:date>
    <item>
      <title>How do i categorize a new variable disregarding a decimal?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-categorize-a-new-variable-disregarding-a-decimal/m-p/698209#M25483</link>
      <description>&lt;P&gt;I have a column called ICD10 and i need to put new values in CODCd based on the info in ICD10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Create values based on ICD10 as:&lt;BR /&gt;1 (I25.XX), 2 (I50.XX), 3 (I63.XX), and 4 (Other)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is what I have&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If MISSING(ICD10) = 1 then CODCd = ".";&lt;BR /&gt;Else if ICD10 = 125 -&amp;lt; 126 then CODCd = 1;&lt;BR /&gt;Else If ICD10 = 150 -&amp;lt; 151 then CODCd = 2;&lt;BR /&gt;Else If ICD10 = 163 -&amp;lt; 164 then CODCd = 3;&lt;BR /&gt;Else 						CodCd = 4;&lt;/PRE&gt;&lt;P&gt;but i keep on getting a syntax error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simpler way of doing this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 19:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-categorize-a-new-variable-disregarding-a-decimal/m-p/698209#M25483</guid>
      <dc:creator>Cooksam13</dc:creator>
      <dc:date>2020-11-11T19:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do i categorize a new variable disregarding a decimal?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-categorize-a-new-variable-disregarding-a-decimal/m-p/698210#M25484</link>
      <description>&lt;P&gt;Your syntax error (you should really show us the log when error(s) appear) is most likely because on the first line of code, you set CODCd to be character; and then on later lines you set it numeric. It can't be both, you have to pick one or the other. I would make the first line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;If MISSING(ICD10) = 1 then CODCd = .;&lt;/PRE&gt;
&lt;P&gt;and now they're all numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as ICD10 codes are concerned, I think this has all been worked out many times here in the forums and elsewhere, and you shouldn't really have to write your own code ... but as I don't personally get involved in work that uses medical codes, I can't help further, but your favorite internet search engine probably can.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lastly, I urge you to look carefully at the codes involved, where you say&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Create values based on ICD10 as:&lt;BR /&gt;1 (I25.XX), 2 (I50.XX), 3 (I63.XX), and 4 (Other)"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;look very very carefully ... the character immediately to the left of 25.XX is not a 1, so when you are testing if something equals 125, I don't think there are ICD10 codes that begin with 125. If it was a 1, then simple rounding down of the decimal to the nearest integer less than or equal to the 125.xx would be dandy, and simple to program ... but it's not a 1.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 19:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-categorize-a-new-variable-disregarding-a-decimal/m-p/698210#M25484</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-11T19:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do i categorize a new variable disregarding a decimal?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-categorize-a-new-variable-disregarding-a-decimal/m-p/698218#M25488</link>
      <description>&lt;P&gt;ICD10 code are character strings (ICD9 codes should be characters strings also).&lt;/P&gt;
&lt;P&gt;So use the : modifier on your comparison operators to do truncated comparisons.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if missing(ICD10) then CODCd = .;
else if ICD10 =: 'I25' then CODCd = 1;
else if ICD10 =: 'I50' then CODCd = 2;
else if ICD10 =: 'I63' then CODCd = 3;
else CodCd = 4;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Nov 2020 20:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-categorize-a-new-variable-disregarding-a-decimal/m-p/698218#M25488</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-11T20:01:25Z</dc:date>
    </item>
  </channel>
</rss>

