<?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 Precedure_code number in the end of Prededure_Name column? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825941#M326234</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to remove the PROCEDURE_CODE number located in the end of the&amp;nbsp;Prededure_Name column.&amp;nbsp; Be wear that not all the text in the&amp;nbsp;Prededure_Name column carries the PROCEDURE_CODE.&amp;nbsp; Please let me know how to approach it; thanks&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datain1;
      infile datalines delimiter=',';
  input PROCEDURE_CODE : 10.  PROCEDURE_NAME : $500.  ;
datalines;
99222, INITIAL HOSP.CARE -LEV 2,
102032759, METHYLPREDNI INJ      40.00MG     102032759,
101502000, ASSIST/TEACH(AMBU/BAG) 15MIN      101502000,
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2022 14:35:56 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2022-07-28T14:35:56Z</dc:date>
    <item>
      <title>Remove Precedure_code number in the end of Prededure_Name column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825941#M326234</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to remove the PROCEDURE_CODE number located in the end of the&amp;nbsp;Prededure_Name column.&amp;nbsp; Be wear that not all the text in the&amp;nbsp;Prededure_Name column carries the PROCEDURE_CODE.&amp;nbsp; Please let me know how to approach it; thanks&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datain1;
      infile datalines delimiter=',';
  input PROCEDURE_CODE : 10.  PROCEDURE_NAME : $500.  ;
datalines;
99222, INITIAL HOSP.CARE -LEV 2,
102032759, METHYLPREDNI INJ      40.00MG     102032759,
101502000, ASSIST/TEACH(AMBU/BAG) 15MIN      101502000,
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 14:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825941#M326234</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-07-28T14:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Precedure_code number in the end of Prededure_Name column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825946#M326235</link>
      <description>&lt;P&gt;I think it will help if you describe some rules as to how to recognize the "number" at the end of the text that should be removed versus other things built with digits that may not be the offending number. You example might imply that the number is always exactly 9 digits, possibly starting with "10".&lt;/P&gt;
&lt;P&gt;For your example of 3 records this seems to work but is subject to the actual definition of the "number". The starting bit is SCAN with the -1 parameter to get the last "word" in the value. You can comment out the Drop to see the values of W as found.&lt;/P&gt;
&lt;PRE&gt;data datain1;
      infile datalines delimiter=',';
  input PROCEDURE_CODE : 10.  PROCEDURE_NAME : $500.  ;
  length w $ 15;
  w= scan(PROCEDURE_NAME,-1);
  if length(w)= 9 and w=:'10' and input(w,9.) ne .
     then PROCEDURE_NAME = substr(PROCEDURE_NAME,1, index(PROCEDURE_NAME,w)-1);
  drop w;
datalines;
99222, INITIAL HOSP.CARE -LEV 2,
102032759, METHYLPREDNI INJ      40.00MG     102032759,
101502000, ASSIST/TEACH(AMBU/BAG) 15MIN      101502000,
;
run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 14:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825946#M326235</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-28T14:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Precedure_code number in the end of Prededure_Name column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825948#M326236</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the number is always at the end of the name ([edit:] and it should not stay elsewhere), you can safely replace it with a blank using the TRANWRD function. (Otherwise consider using the TRANSTRN function.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set datain1;
procedure_name=tranwrd(procedure_name,strip(put(procedure_code,32.)),' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 15:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825948#M326236</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-07-28T15:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Precedure_code number in the end of Prededure_Name column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825950#M326237</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datain1;
  infile datalines delimiter=',';
  input PROCEDURE_CODE : 10.  PROCEDURE_NAME : $500.  ;
  &lt;FONT color="#0000FF"&gt;PROCEDURE=TRANSTRN(PROCEDURE_NAME,put(PROCEDURE_CODE,best.),trimn(" ")) ;&lt;/FONT&gt; /*code*/
datalines;
99222, INITIAL HOSP.CARE -LEV 2,
102032759, METHYLPREDNI INJ      40.00MG     102032759,
101502000, ASSIST/TEACH(AMBU/BAG) 15MIN      101502000,
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 15:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Precedure-code-number-in-the-end-of-Prededure-Name-column/m-p/825950#M326237</guid>
      <dc:creator>kleelasiva9</dc:creator>
      <dc:date>2022-07-28T15:00:01Z</dc:date>
    </item>
  </channel>
</rss>

