<?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 Remove all decimals in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936965#M42100</link>
    <description>&lt;P&gt;Hi guys, I have a dataset with a column (i.e., a variable) with some values having .0. The decimal is always 0. I would like to remove .0. To do this, I used the following code: diagnosis_corrected&amp;nbsp;= compress(DIAGNOSIS,'.'), but unfortunately values like&amp;nbsp;0726 become 726 and I would like they remain&amp;nbsp;0796. Like this, there are other values starting with 0.&amp;nbsp; How can I remove all decimals while preserving cases like&amp;nbsp;0796?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data DB; &lt;BR /&gt;input ID :$20. DIAGNOSIS $20.;&lt;BR /&gt;cards;&lt;BR /&gt;0001 234.0&lt;BR /&gt;0001 4321.0&lt;BR /&gt;0002 V00080&lt;BR /&gt;0002 254&lt;BR /&gt;0003 876&lt;BR /&gt;0003 V98.0&lt;/P&gt;
&lt;P&gt;0004 0796&lt;/P&gt;
&lt;P&gt;0004 0543&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: the variable is a character variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2024 14:44:37 GMT</pubDate>
    <dc:creator>NewUsrStat</dc:creator>
    <dc:date>2024-07-24T14:44:37Z</dc:date>
    <item>
      <title>Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936965#M42100</link>
      <description>&lt;P&gt;Hi guys, I have a dataset with a column (i.e., a variable) with some values having .0. The decimal is always 0. I would like to remove .0. To do this, I used the following code: diagnosis_corrected&amp;nbsp;= compress(DIAGNOSIS,'.'), but unfortunately values like&amp;nbsp;0726 become 726 and I would like they remain&amp;nbsp;0796. Like this, there are other values starting with 0.&amp;nbsp; How can I remove all decimals while preserving cases like&amp;nbsp;0796?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data DB; &lt;BR /&gt;input ID :$20. DIAGNOSIS $20.;&lt;BR /&gt;cards;&lt;BR /&gt;0001 234.0&lt;BR /&gt;0001 4321.0&lt;BR /&gt;0002 V00080&lt;BR /&gt;0002 254&lt;BR /&gt;0003 876&lt;BR /&gt;0003 V98.0&lt;/P&gt;
&lt;P&gt;0004 0796&lt;/P&gt;
&lt;P&gt;0004 0543&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: the variable is a character variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936965#M42100</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T14:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936967#M42101</link>
      <description>&lt;P&gt;If you want to remove the decimals, simply assign a format like 8.0 to the variable. This assumes the variable is numeric, and I'm getting the impression that maybe its not numeric, it is character. Which is it?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 13:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936967#M42101</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-24T13:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936969#M42102</link>
      <description>Yes, it is char. I will edit my post.</description>
      <pubDate>Wed, 24 Jul 2024 13:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936969#M42102</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T13:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936970#M42103</link>
      <description>&lt;P&gt;Convert the character string to actual numbers, then assign a format like 8.0.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 13:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936970#M42103</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-24T13:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936971#M42104</link>
      <description>I cannot. The variable must be char consistently with another dataset</description>
      <pubDate>Wed, 24 Jul 2024 13:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936971#M42104</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T13:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936974#M42105</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I cannot. The variable must be char consistently with another dataset&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know what this means. You can work with numbers as numbers and then convert back to character to be consistent with another data set. But I don't even understand why someone has set up a system of data where numbers are characters, unless these are some sort of ID values, and if these are ID values, how did they get the .0 on the end?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936974#M42105</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-24T14:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936975#M42106</link>
      <description>&lt;P&gt;So, basically there are the values of that variable that could be also like: V0008. This is why it should remain char.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936975#M42106</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T14:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936979#M42107</link>
      <description>&lt;P&gt;I'm not sure I understand. Your explanations are very incomplete. Are you saying that you have a V0008.0 and you have to remove the .0 ??? Or are you saying something else?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936979#M42107</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-24T14:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936985#M42108</link>
      <description>Yes, all can be: V0008.0 or sometimes V0012 (without .0), values like the ones I showed: 234.0, 4321.0 but also values without the decimal like: 654, 764.</description>
      <pubDate>Wed, 24 Jul 2024 14:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936985#M42108</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T14:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936987#M42109</link>
      <description>&lt;P&gt;Use the TRANWRD function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newvariable = tranwrd(oldvariable,".0","");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936987#M42109</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-24T14:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936989#M42110</link>
      <description>I edited the post!</description>
      <pubDate>Wed, 24 Jul 2024 14:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936989#M42110</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T14:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936992#M42111</link>
      <description>&lt;P&gt;Thank you very much for your help. I tried with "tranwrd" but unfortunately 0796 becomes 796 while it should not change.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936992#M42111</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T14:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936993#M42112</link>
      <description>&lt;P&gt;Please, when you try something and it doesn't work, don't say "it doesn't work" and stop there, with no other information provided. Please, always show us the code. Please always show us the output.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 14:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936993#M42112</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-24T14:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936995#M42113</link>
      <description>No, sorry it worked at the end. Thank you very much!</description>
      <pubDate>Wed, 24 Jul 2024 14:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936995#M42113</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T14:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936996#M42114</link>
      <description>&lt;P&gt;Looks like you are trying to clean up some old ICD-9 diagnosis codes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The COMPRESS() function call you showed would have only removed the periods.&amp;nbsp; It would not have removed the leading zero, like you showed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you saying that you also need to convert strings that are too short to be valid ICD-9 code be assuming they are missing a leading zero and add it back?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that it is not uncommon to see invalid ICD-9 codes appear in real world data.&amp;nbsp; Data entry is hard.&amp;nbsp; And some hospital system might even be consistent at inventing their own variations on valid codes, like add the extra zero at the end on a code that does not actually need the extra zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since there are only a finite number of valid ICD-9 codes it might be easier to make a table with all of the valid codes and also add in every misspelling you have found and determined how to map.&amp;nbsp; For example you might do it by making a format (or even an informat) and use that to help you both clean and detect new strange codes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example is 0543 supposed to be:&lt;/P&gt;
&lt;P&gt;&lt;A id="054.3" class="identifier" href="http://www.icd9data.com/2015/Volume1/001-139/050-059/054/054.3.htm" name="054.3" target="_blank"&gt;054.3&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="threeDigitCodeListDescription"&gt;Herpetic meningoencephalitis&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="threeDigitCodeListDescription"&gt;or perhaps one of these two?&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL class="codeHierarchyUL"&gt;
&lt;LI class="hierarchyLine"&gt;&lt;SPAN class="localLine highlight"&gt;&lt;A id="534" class="identifier" href="http://www.icd9data.com/2015/Volume1/520-579/530-539/534/534.htm" name="534" target="_blank"&gt;534&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="threeDigitCodeListDescription"&gt;Gastrojejunal ulcer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="hierarchyLine"&gt;&lt;SPAN class="localLine"&gt;&lt;A id="534.0" class="identifier" href="http://www.icd9data.com/2015/Volume1/520-579/530-539/534/534.0.htm" name="534.0" target="_blank"&gt;534.0&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="threeDigitCodeListDescription"&gt;Acute gastrojejunal ulcer with hemorrhage&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 15:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/936996#M42114</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-07-24T15:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all decimals</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/937030#M42120</link>
      <description>Thank you very much Tom for sharing your expertise about this issue. I think that creating a sort of dictionary is really time-consuming and requires a lot of effort.</description>
      <pubDate>Wed, 24 Jul 2024 16:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-all-decimals/m-p/937030#M42120</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-07-24T16:50:18Z</dc:date>
    </item>
  </channel>
</rss>

