<?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: How to remove digits from the observations? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202702#M266906</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abu, I was out on the communities today and noticed your question. I'm sure that a SAS expert will answer you soon. I happened to see this, just in case it helps: &lt;A __default_attr="184047" __jive_macro_name="message" class="jive_macro jive_macro_message" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Mar 2015 19:14:36 GMT</pubDate>
    <dc:creator>Community_Help</dc:creator>
    <dc:date>2015-03-16T19:14:36Z</dc:date>
    <item>
      <title>How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202701#M266905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts, &lt;/P&gt;&lt;P&gt;The following is the sample of my dataset. I need to remove the first two and last two digits of "firms".&lt;/P&gt;&lt;P&gt;date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firms&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;22/10/2008&lt;/TD&gt;&lt;TD&gt;AN8068571086&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;26/02/2010&lt;/TD&gt;&lt;TD&gt;AN8068571086&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;05/08/2011&lt;/TD&gt;&lt;TD&gt;AN8068571086&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27/09/2011&lt;/TD&gt;&lt;TD&gt;AN8068571086&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;25/10/2011&lt;/TD&gt;&lt;TD&gt;AN8068571086&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;23/11/2011&lt;/TD&gt;&lt;TD&gt;AN8068571086&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;26/06/2012&lt;/TD&gt;&lt;TD&gt;AN8068571086&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It means, now "firms" will be like 80685710. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Mar 2015 18:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202701#M266905</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-16T18:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202702#M266906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abu, I was out on the communities today and noticed your question. I'm sure that a SAS expert will answer you soon. I happened to see this, just in case it helps: &lt;A __default_attr="184047" __jive_macro_name="message" class="jive_macro jive_macro_message" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Mar 2015 19:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202702#M266906</guid>
      <dc:creator>Community_Help</dc:creator>
      <dc:date>2015-03-16T19:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202703#M266907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input date ddmmyy10. firms :$15.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;22/10/2008&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;26/02/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;05/08/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;27/09/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;25/10/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;23/11/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;26/06/2012&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;do i= 1 to length(firms);&lt;/P&gt;&lt;P&gt;new_firms=substr(firms,i,1);&lt;/P&gt;&lt;P&gt;if i in (1,2) or i=length(firms)-1 or i=length(firms) then continue;&lt;/P&gt;&lt;P&gt;group+1;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;call missing(group);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;array a(15) $1 _temporary_;&lt;/P&gt;&lt;P&gt;call missing (of a{*});&lt;/P&gt;&lt;P&gt;do until(last.date);&lt;/P&gt;&lt;P&gt;set want;&lt;/P&gt;&lt;P&gt;by date;&lt;/P&gt;&lt;P&gt;a(group)=new_firms;&lt;/P&gt;&lt;P&gt;firm=cats(of a{*});&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;keep date firm;&lt;/P&gt;&lt;P&gt;format date ddmmyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Naveen Srinivasan&lt;/P&gt;&lt;P&gt;L&amp;amp;T Infotech&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Mar 2015 19:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202703#M266907</guid>
      <dc:creator>naveen_srini</dc:creator>
      <dc:date>2015-03-16T19:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202704#M266908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds like you are looking for a simple "chop off some characters":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firms = substr(firms, 3, 8);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is possible that number of characters changes from record to record, you could use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firms = substr(firms, 3, length(firms)-4);&lt;/P&gt;&lt;P&gt;&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, 16 Mar 2015 19:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202704#M266908</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-03-16T19:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202705#M266909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input date ddmmyy10. firms :$15.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;22/10/2008&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;26/02/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;05/08/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;27/09/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;25/10/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;23/11/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;26/06/2012&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;new_firms=prxchange('s/^\w\w|\w\w$//io',-1, strip(firms));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 01:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202705#M266909</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-03-17T01:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202706#M266910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It is not working and shows the following messages:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Numeric values have been converted to character values at the places given by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Line):(Column).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127:16&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Line):(Column).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127:9&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 12:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202706#M266910</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-17T12:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202707#M266911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;After running your codes, more observations are shown in the "Final" dataset than the original dataset. How to address this issue?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 12:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202707#M266911</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-17T12:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202708#M266912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input date ddmmyy10. firms :$15.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;22/10/2008&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;26/02/2010&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;05/08/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;27/09/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;25/10/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;23/11/2011&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;26/06/2012&amp;nbsp;&amp;nbsp;&amp;nbsp; AN8068571086&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt; set have;&lt;/P&gt;&lt;P&gt; length want $ 20;&lt;/P&gt;&lt;P&gt; want=substr(firms,3,length(firms)-4);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 13:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202708#M266912</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-03-17T13:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202709#M266913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Abu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both Astounding's and Haikuo's code should have worked. I think you will have to post an example of your data (in the form of a data step), and the code you ran that produced the notes, in order for anyone here to be able to help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 13:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202709#M266913</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-03-17T13:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202710#M266914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tested mine using the sample data you provided. It appeared to me the dataset is sorted by date. So, in the 1st datastep, the dataset gets flipped as each date duplicates forms a group. So here &lt;STRONG&gt;unless your real&lt;/STRONG&gt; matches with &lt;STRONG&gt;your sample&lt;/STRONG&gt;, i can't tell until you let us know what it really looks like. I just reran the same code that I gave you and that seems ok.&lt;/P&gt;&lt;P&gt;Either way, &lt;STRONG&gt;prx&lt;/STRONG&gt; is perhaps the most ideal for character manipulation, so I'd suggest implement Haikuo's code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 13:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202710#M266914</guid>
      <dc:creator>naveen_srini</dc:creator>
      <dc:date>2015-03-17T13:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202711#M266915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I include the SAS file.I cannot attach the SAS file, but I have attached the CSV file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 14:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202711#M266915</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-17T14:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202712#M266916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I cannot attach the SAS file. So I have attached the CSV file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 14:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202712#M266916</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-17T14:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202713#M266917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You did not include the key information from the log that would show what statement was on line 127 and what variable was being referenced at columns 9 and 16.&lt;/P&gt;&lt;P&gt;Are you trying to remove digits from the middle of a NUMBER?&amp;nbsp; If so then those are not errors just notes showing that SAS had to convert the number to a character string to perform the substr() and then convert the string result back to a number.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 14:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202713#M266917</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-17T14:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202714#M266918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, I want to remove the first two digits and last two digits from "cusip" observations. Those notes were shown in log file. And the output dataset shows blank observations i.e. no observation at all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 14:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202714#M266918</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-17T14:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202715#M266919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will guess that your error occurred when you imported the file and possibly read the first line (the variable name header) as data. The following worked for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format tradedate ddmmyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile "c:\temp\buy_16mar2015.csv" dlm=',' firstobs=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input tradedate ddmmyy10. cusip :$15.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cusip = substr(cusip, 3, length(cusip)-4);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 14:52:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202715#M266919</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-03-17T14:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202716#M266920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Abu for making it more clear. Thumb rule is always to explain the question well by helping us to help you. I have made the necessary changes in the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;do i= 1 to length(cusip);&lt;/P&gt;&lt;P&gt;new_cusip=substr(cusip,i,1);&lt;/P&gt;&lt;P&gt;if i in (1,2) or i=length(cusip)-1 or i=length(cusip) then continue;&lt;/P&gt;&lt;P&gt;group=_n_;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;array a(15) $1 _temporary_;&lt;/P&gt;&lt;P&gt;call missing (of a{*});&lt;/P&gt;&lt;P&gt;do _n_=1 by 1 until(last.group);&lt;/P&gt;&lt;P&gt;set want;&lt;/P&gt;&lt;P&gt;by group;&lt;/P&gt;&lt;P&gt;a(_n_)=new_cusip;&lt;/P&gt;&lt;P&gt;trunc_cusip=cats(of a{*});&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;keep tradedate trunc_cusip;&lt;/P&gt;&lt;P&gt;format tradedate ddmmyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day,&lt;/P&gt;&lt;P&gt;Naveen Srinivasan&lt;/P&gt;&lt;P&gt;L&amp;amp;T Infotech&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 15:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202716#M266920</guid>
      <dc:creator>naveen_srini</dc:creator>
      <dc:date>2015-03-17T15:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202717#M266921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="828501" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; Hello, It would be nice and courteous of you if you could mark the question as answered and gift the points to the people who have helped you. Asking questions, one after another is alright but please acknowledge the help. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 19:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202717#M266921</guid>
      <dc:creator>MarkWik</dc:creator>
      <dc:date>2015-03-17T19:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202718#M266922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I will definitely do that. I was just checking all codes. And thanks a lot to everybody. I am grateful to all of you. I wanted to mark 'correct' or 'helpful' to everybody but I cannot. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2015 21:50:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202718#M266922</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-18T21:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202719#M266923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Abu: Out of curiosity, why didn't Astounding's originally suggested code work for you?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2015 22:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202719#M266923</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-03-18T22:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove digits from the observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202720#M266924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur,&lt;/P&gt;&lt;P&gt;I don't know actually. It showed the following notes and output dataset had no observations. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;NOTE: Numeric values have been converted to character values at the places given by:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Line):(Column).&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127:16&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Line):(Column).&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127:9&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;It may be because I missed something while running the code. I also wanted to mark Astounding's code as correct or helpful answer, but I couldn't. After I marked two helpful answers, I found that I cannot choose anymore. But Astounding's code is really helpful (and may be correct; I don't know exactly since I could not run the code).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2015 23:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-digits-from-the-observations/m-p/202720#M266924</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-03-18T23:43:38Z</dc:date>
    </item>
  </channel>
</rss>

