<?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: =LEFT(X,4) EXCEL STYLE FUNCTION ON SAS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85310#M24404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is exactly what I needed!&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For those using Miner, I have an account number 15 digits long (Char15). I only need the first 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS Code Node read:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &amp;amp;EM_EXPORT_TRAIN; set &amp;amp;EM_IMPORT_DATA;&lt;/P&gt;&lt;P&gt;CM11=SUBSTR(ACCT_NO,1,11);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Returns the same value as Excel; =&lt;/P&gt;&lt;P&gt;Left(ACCT_NO,11)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Mar 2015 17:28:25 GMT</pubDate>
    <dc:creator>C_Ishihara</dc:creator>
    <dc:date>2015-03-09T17:28:25Z</dc:date>
    <item>
      <title>=LEFT(X,4) EXCEL STYLE FUNCTION ON SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85306#M24400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking to perform a similar function in SAS to =Left(x,4)&amp;nbsp; on excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know the command for this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Jun 2012 04:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85306#M24400</guid>
      <dc:creator>spraynardz90</dc:creator>
      <dc:date>2012-06-17T04:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: =LEFT(X,4) EXCEL STYLE FUNCTION ON SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85307#M24401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try using Substr function or directly you can use year function to extract the year from the given date.&lt;/P&gt;&lt;P&gt;cc=year(&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;datadate);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Jun 2012 10:35:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85307#M24401</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-06-17T10:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: =LEFT(X,4) EXCEL STYLE FUNCTION ON SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85308#M24402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you really have these variables as character strings then SUBSTR(x,1,4) will take the first 4 characters of the field.&amp;nbsp; If for some reason the value is pushed right in the field you could use the LEFT() or STRIP() function to remove the leading spaces first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More likely you have the data stored as a number.&amp;nbsp; If it is really a date in the format YYYYMMDD then you should store it as a date.&amp;nbsp; Then the YEAR() function will be able to take the year part of the date for you.&lt;/P&gt;&lt;P&gt;If instead you just have it stored as number (For example &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;19,701,231) then you could use INT(datadate/10000) to find the digits from the 10 million to 10 thousands place.&amp;nbsp; Or you could convert it to a date and then use the YEAR function.&amp;nbsp; year(input(put(datadate,z8.),yymmdd8.))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2012 16:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85308#M24402</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-06-18T16:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: =LEFT(X,4) EXCEL STYLE FUNCTION ON SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85309#M24403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If DATADATE is character, and left-hand-justified, here are a couple of simple tricks to getting the year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want YEAR as numeric, read just the first four characters of DATADATE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;year = input(datadate, 4.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want YEAR as character, copy into a shorter variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length year $ 4;&lt;/P&gt;&lt;P&gt;year = datadate;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If DATADATE is numeric, then other posters have mentioned the right issues.&amp;nbsp; You have to begin with asking what number is actually stored there (the digits in your post, vs. a SAS date).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2012 16:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85309#M24403</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-06-18T16:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: =LEFT(X,4) EXCEL STYLE FUNCTION ON SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85310#M24404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is exactly what I needed!&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For those using Miner, I have an account number 15 digits long (Char15). I only need the first 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS Code Node read:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &amp;amp;EM_EXPORT_TRAIN; set &amp;amp;EM_IMPORT_DATA;&lt;/P&gt;&lt;P&gt;CM11=SUBSTR(ACCT_NO,1,11);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Returns the same value as Excel; =&lt;/P&gt;&lt;P&gt;Left(ACCT_NO,11)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 17:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LEFT-X-4-EXCEL-STYLE-FUNCTION-ON-SAS/m-p/85310#M24404</guid>
      <dc:creator>C_Ishihara</dc:creator>
      <dc:date>2015-03-09T17:28:25Z</dc:date>
    </item>
  </channel>
</rss>

