<?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: Variable with character and numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-with-character-and-numeric/m-p/507858#M136334</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input job_code$ @@;
level=ifc(anydigit(job_code)=0, job_code, compress(job_code,, 'kd'));
datalines;
TA2 SPC
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As for your second requirement, use a&amp;nbsp;Select-When Statement or a costum format.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Oct 2018 18:50:05 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-10-26T18:50:05Z</dc:date>
    <item>
      <title>Variable with character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-with-character-and-numeric/m-p/507857#M136333</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Job_code" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24420iDAF4909DD522C713/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Job_code" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Job_code&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in the variable job code there are levels " example TM1" is level 1...etc. Its a mixed variable and I want to separate the numeric value from the characters. If it doesn't have any numeric then leave it as is "example SPC" . I am trying to calculate a bonus variable using the numeric value from job_code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, produce a new variable for the year-end bonus, which is defined as:&amp;nbsp;&lt;/P&gt;&lt;P&gt;3% for level 1 employees, plus $1,500 for all with 30 or more years of service&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.75% for level 2, plus $2,500 for all with 30 or more years of service&amp;nbsp;&lt;/P&gt;&lt;P&gt;4.5% for level 3, plus $3,000 for all with 30 or more years of service&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.5% for others, plus $2,000 for all with 30 or more years of service&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc datasets lib=work kill;run;&lt;BR /&gt;filename rawdata '\\seashare\blumj\SAS Programming Data\Raw Data';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data pay;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;infile rawdata('payroll.txt');&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @1 DOB date9. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/145066"&gt;@10&lt;/a&gt; Hire_date date9. Empid$ 19-22&amp;nbsp; gender$ 23 job_code$ 24-26 salary:comma.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Today=today();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; days = today - dob;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; age = floor(days / 365);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; work_days=today-hire_date;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Yrs_at_job=floor(work_days/365);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if age ge 62 then Retirement='Y';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if age ge 55 and Yrs_at_job ge 25 then Retirement='Y';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else Retirement='N';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;format Today date9. DOB date9. Hire_date date9. ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;drop days today work_days ;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 18:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-with-character-and-numeric/m-p/507857#M136333</guid>
      <dc:creator>chrissowden</dc:creator>
      <dc:date>2018-10-26T18:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Variable with character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-with-character-and-numeric/m-p/507858#M136334</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input job_code$ @@;
level=ifc(anydigit(job_code)=0, job_code, compress(job_code,, 'kd'));
datalines;
TA2 SPC
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As for your second requirement, use a&amp;nbsp;Select-When Statement or a costum format.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 18:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-with-character-and-numeric/m-p/507858#M136334</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-10-26T18:50:05Z</dc:date>
    </item>
  </channel>
</rss>

