<?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: to get left 3 digits of numeric value in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226557#M54053</link>
    <description>&lt;P&gt;Hi. &amp;nbsp;If EMPID is numeric ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data one;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;input empid @@;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;174078 121764 190333 214078 &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data two;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;set one;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;three = input(cat(empid),3.);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;data set TWO ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;Obs empid &amp;nbsp;three&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;1 &amp;nbsp; 174078 &amp;nbsp;174&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;2 &amp;nbsp; 121764 &amp;nbsp;121&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;3 &amp;nbsp; 190333 &amp;nbsp;190&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;4 &amp;nbsp; 214078 &amp;nbsp;214&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Sep 2015 14:06:23 GMT</pubDate>
    <dc:creator>MikeZdeb</dc:creator>
    <dc:date>2015-09-21T14:06:23Z</dc:date>
    <item>
      <title>to get left 3 digits of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226535#M54048</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a column, the employee code having 6 digits is mentioned . If I want to see the first 3 digit of the employee code in a column, please suggest the sas code for this.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Employeecode&lt;/TD&gt;&lt;TD&gt;first 3 digits&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;174078&lt;/TD&gt;&lt;TD&gt;174&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;121764&lt;/TD&gt;&lt;TD&gt;121&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;190333&lt;/TD&gt;&lt;TD&gt;190&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;214078&lt;/TD&gt;&lt;TD&gt;214&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 21 Sep 2015 10:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226535#M54048</guid>
      <dc:creator>mprasannna</dc:creator>
      <dc:date>2015-09-21T10:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: to get left 3 digits of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226536#M54049</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that the id is text:&lt;/P&gt;&lt;P&gt;three_chars=substr(left(id),1,3);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If number then:&lt;/P&gt;&lt;P&gt;three_chars=substr(put(id,6.),1,3);&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 10:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226536#M54049</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-09-21T10:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: to get left 3 digits of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226537#M54050</link>
      <description>&lt;P&gt;if the employee code is a number, then you would need to convert it to a character first, then use Character functions to get the first three digits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data _null_;&lt;BR /&gt;&amp;nbsp;employee_code = 174078; /* Numeric */&lt;BR /&gt;&amp;nbsp;first_3_digits = INPUT(SUBSTR(PUT(employee_code,6.),1,3),3.); /* Num -&amp;gt; Char -&amp;gt; Num */&lt;BR /&gt;&amp;nbsp;put _all_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 10:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226537#M54050</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2015-09-21T10:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: to get left 3 digits of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226541#M54051</link>
      <description>&lt;P&gt;Try this code;&lt;/P&gt;
&lt;P&gt;data one; infile cards;&lt;BR /&gt;input @1 empid;&lt;BR /&gt;cards;&lt;BR /&gt;174078 &lt;BR /&gt;121764 &lt;BR /&gt;190333 &lt;BR /&gt;214078 &lt;BR /&gt;;&lt;BR /&gt;data; set; format x 3.;&lt;BR /&gt;x=trunc((empid/1000),3);&lt;BR /&gt;proc print; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 10:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226541#M54051</guid>
      <dc:creator>Jim_G</dc:creator>
      <dc:date>2015-09-21T10:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: to get left 3 digits of numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226557#M54053</link>
      <description>&lt;P&gt;Hi. &amp;nbsp;If EMPID is numeric ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data one;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;input empid @@;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;174078 121764 190333 214078 &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data two;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;set one;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;three = input(cat(empid),3.);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;data set TWO ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;Obs empid &amp;nbsp;three&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;1 &amp;nbsp; 174078 &amp;nbsp;174&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;2 &amp;nbsp; 121764 &amp;nbsp;121&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;3 &amp;nbsp; 190333 &amp;nbsp;190&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;4 &amp;nbsp; 214078 &amp;nbsp;214&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 14:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/to-get-left-3-digits-of-numeric-value/m-p/226557#M54053</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2015-09-21T14:06:23Z</dc:date>
    </item>
  </channel>
</rss>

