<?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 How do I remove excessive delimiter? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-remove-excessive-delimiter/m-p/628278#M20650</link>
    <description>&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I have a variable which shows the years of experience and it is like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YrsofEXP&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;5.00&lt;/P&gt;&lt;P&gt;5 years&lt;/P&gt;&lt;P&gt;5 yrs&lt;/P&gt;&lt;P&gt;3 in September&lt;/P&gt;&lt;P&gt;Less than a year&lt;/P&gt;&lt;P&gt;2 1/3&lt;/P&gt;&lt;P&gt;10+&lt;/P&gt;&lt;P&gt;12 and above&lt;/P&gt;&lt;P&gt;8.&lt;/P&gt;&lt;P&gt;10 years&amp;nbsp;&lt;/P&gt;&lt;P&gt;8 plus years&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want result with years. For example;&lt;/P&gt;&lt;P&gt;YrsofEXP&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;But, I want result just in years. How do I remove all those alphabets? My total observation is around 900.&lt;/P&gt;&lt;P&gt;I would appreciate your help. Thank you much.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Feb 2020 17:11:36 GMT</pubDate>
    <dc:creator>aayeshasingh</dc:creator>
    <dc:date>2020-02-28T17:11:36Z</dc:date>
    <item>
      <title>How do I remove excessive delimiter?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-remove-excessive-delimiter/m-p/628278#M20650</link>
      <description>&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I have a variable which shows the years of experience and it is like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YrsofEXP&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;5.00&lt;/P&gt;&lt;P&gt;5 years&lt;/P&gt;&lt;P&gt;5 yrs&lt;/P&gt;&lt;P&gt;3 in September&lt;/P&gt;&lt;P&gt;Less than a year&lt;/P&gt;&lt;P&gt;2 1/3&lt;/P&gt;&lt;P&gt;10+&lt;/P&gt;&lt;P&gt;12 and above&lt;/P&gt;&lt;P&gt;8.&lt;/P&gt;&lt;P&gt;10 years&amp;nbsp;&lt;/P&gt;&lt;P&gt;8 plus years&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want result with years. For example;&lt;/P&gt;&lt;P&gt;YrsofEXP&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;But, I want result just in years. How do I remove all those alphabets? My total observation is around 900.&lt;/P&gt;&lt;P&gt;I would appreciate your help. Thank you much.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 17:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-remove-excessive-delimiter/m-p/628278#M20650</guid>
      <dc:creator>aayeshasingh</dc:creator>
      <dc:date>2020-02-28T17:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove excessive delimiter?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-remove-excessive-delimiter/m-p/628437#M20666</link>
      <description>&lt;P&gt;Looks like you're dealing with a free-text field so there isn't much else you can do than to analyse the text and then write custom logic to convert the data into a numerical value.&lt;/P&gt;
&lt;P&gt;Good thing is that you're only dealing with 900 obs so things should be manageable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below code could give you a start. Just run it, look what remains with the Proc Freq report and extend the program logic until there is no leftover.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover;
  input YrsofEXP $20.;
  datalines;
5.00
5 years
5 yrs
3 in September
Less than a year
2 1/3
10+
12 and above
8.
10 years 
8 plus years
;

data want remainder;
  set have;
  if not missing(YrsofEXP) then
    do;
      YrsofEXP_num=input(compress(YrsofEXP,'./','kd'), ?? best32.);
      /** here add more logic to read the remaining patterns into a SAS numerical variable **/
/*      if missing(YrsofEXP_num) then YrsofEXP_num= &amp;lt;some logic&amp;gt;;*/
      /**  **/
    end;
  if missing(YrsofEXP) then output want;
  else if cmiss(YrsofEXP_num,YrsofEXP)=0 then output want;
  else output remainder;
run;

data remaining_patterns;
  set remainder;
  length patter $20;
  pattern=prxchange('s/\d/d/oi',-1,YrsofEXP);
run;
title 'Not yet converted patterns';
proc freq data=pattern;
  table pattern /nocum nopercent;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 178px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36474iED3AE0DDFC876490/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Feb 2020 14:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-remove-excessive-delimiter/m-p/628437#M20666</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-02-29T14:37:52Z</dc:date>
    </item>
  </channel>
</rss>

