<?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: Extract CPT code with restriction? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-CPT-code-with-restriction/m-p/892763#M352632</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for supplying the data in data steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code returns what you have shown in the want data set, but it does not contain "&lt;SPAN&gt;99220&lt;/SPAN&gt;", which is in your problem description.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
  set cpt;
  
  /* check there are no non-digits in cpt and that it has a length of 5 */
  where not notdigit(strip(cpt)) and length(cpt) eq 5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2023 15:25:45 GMT</pubDate>
    <dc:creator>Amir</dc:creator>
    <dc:date>2023-09-05T15:25:45Z</dc:date>
    <item>
      <title>Extract CPT code with restriction?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-CPT-code-with-restriction/m-p/892757#M352628</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;In the following sample dataset, I would like to extract "99223", "99469", "99220" in the CPT column.&amp;nbsp; The extracted number list is needed only to have 5-digit numbers in the CPT column.&amp;nbsp; Please help, thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data CPT;  
	length CPT $10 status 3; 
	infile datalines delimiter=','; 
	input CPT status;  
	datalines;                     
	99223,2,
	30182374,2,
	30687798,3,
	99469,2,
	A0425,3,
	10992200,4,
;   

data want;
 	length CPT $10 status 3; 
	infile datalines delimiter=','; 
	input CPT status;  
	datalines;                     
	99223,2,
	99469,2,
;   &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Sep 2023 15:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-CPT-code-with-restriction/m-p/892757#M352628</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-09-05T15:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract CPT code with restriction?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-CPT-code-with-restriction/m-p/892760#M352630</link>
      <description>LENGTH function.</description>
      <pubDate>Tue, 05 Sep 2023 15:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-CPT-code-with-restriction/m-p/892760#M352630</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-05T15:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extract CPT code with restriction?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-CPT-code-with-restriction/m-p/892763#M352632</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for supplying the data in data steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code returns what you have shown in the want data set, but it does not contain "&lt;SPAN&gt;99220&lt;/SPAN&gt;", which is in your problem description.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
  set cpt;
  
  /* check there are no non-digits in cpt and that it has a length of 5 */
  where not notdigit(strip(cpt)) and length(cpt) eq 5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 15:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-CPT-code-with-restriction/m-p/892763#M352632</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2023-09-05T15:25:45Z</dc:date>
    </item>
  </channel>
</rss>

