<?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: Cutting &amp;amp; deleting characters from string in an array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326655#M72794</link>
    <description>&lt;P&gt;Sorry, you have actually posted the bit of the log right between important bits. &amp;nbsp;I am specifically looking at notes/errors/warnings. &amp;nbsp;The reason being is this kind of output occurs when you substr invalid data, or input invalid numeric data or something along those lines. &amp;nbsp;What SAS does is print out all the data for that observation where that error occurs, hence as all your data seems to have the same problem, i.e. a logic problem, then you are getting large amounts of output in the log.&lt;/P&gt;
&lt;P&gt;It is likely down to your array statements:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; array ops_ko ops_ko1-ops_ko100;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;These create numeric arrays, and you are trying to put substring information into them. &amp;nbsp;Try chaning to something like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; array ops_ko $200. ops_ko1-ops_ko100;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also note, this is a very good example of &lt;STRONG&gt;why it is recommended to post test data - in the form of a datastep&amp;nbsp;-&lt;/STRONG&gt; so that we can see exactly what you are working with. &amp;nbsp;I do not see what you do, nor can I run what you are running! &amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2017 10:08:48 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-01-23T10:08:48Z</dc:date>
    <item>
      <title>Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/325981#M72547</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp; am trying for a few days already to cut the last 8 digits from a string into a new variable and delete theses digits from the old one. It needs to be done over 100 variables, so it has to be within an array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The original variables look like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1234b8:r:20060607&lt;/P&gt;&lt;P&gt;627::20071012&lt;/P&gt;&lt;P&gt;382027:l:20071212&lt;/P&gt;&lt;P&gt;182b::20071615&lt;/P&gt;&lt;P&gt;17293b:r:20081281&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are 100 of these kind.&lt;/P&gt;&lt;P&gt;I tried scan and substr, that works for a single variable, but somehow within the array, the values with a character between the :: get lost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result should look like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var&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;&amp;nbsp; Date&lt;/P&gt;&lt;P&gt;1234b8:r&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20060607&lt;/P&gt;&lt;P&gt;382027:l&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20071212&lt;/P&gt;&lt;P&gt;182b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20071615&lt;/P&gt;&lt;P&gt;17293b:r&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20081281&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably there is an easy way to do that, but I can't find it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;All the best!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 14:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/325981#M72547</guid>
      <dc:creator>sasseln</dc:creator>
      <dc:date>2017-01-19T14:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/325997#M72555</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  length thevar var date $50;
  thevar="1234b8:r:20060607";
  date=substr(thevar,lengthn(thevar)-7,10);
  var=tranwrd(thevar,strip(date),"");
run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jan 2017 15:16:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/325997#M72555</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-19T15:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326005#M72559</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string : $20.;
cards;
1234b8:r:20060607
627::20071012
382027:l:20071212
182b::20071615
17293b:r:20081281
;
run;

data want;
set have;
length datestr $8;
format date yymmdd10.;
datestr = scan(string,-1,':','m');
date = input(datestr,yymmdd8.);
string = catx(':',scan(string,1,':','m'),scan(string,2,':','m'));
run;

proc print data=want noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;PRE&gt;string      datestr           date

1234b8:r    20060607    2006-06-07
627         20071012    2007-10-12
382027:l    20071212    2007-12-12
182b        20071615             .
17293b:r    20081281             .
&lt;/PRE&gt;
&lt;P&gt;Note that you have some invalid dates.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 15:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326005#M72559</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-19T15:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326015#M72562</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;'s code will result in a missing value for var if the first and second strings are the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following is a slight modification of his code that corrects for that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  length thevar $50;
  input;
  thevar=_infile_;
  cards;
1234b8:r:20060607
627::20071012
382027:l:20071212
182b::20071615
17293b:r:20081281
2008128120081281
;

data want;
  set have;
  length var date $50;
  date=substr(thevar,lengthn(thevar)-7,10);
  var=substr(thevar,1,lengthn(thevar)-8);
run;
&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 15:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326015#M72562</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-19T15:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326017#M72563</link>
      <description>&lt;P&gt;If you can do it for one variable accurately, using arrays shouldn't change the outcome.&amp;nbsp; One example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;array original {100} original_1 - original_100;&lt;/P&gt;
&lt;P&gt;array dates {100} $ 8 date_1 - date_100;&lt;/P&gt;
&lt;P&gt;do _n_=1 to 100;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; dates{_n_} = scan(original{_n_}, -1, ':');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; original{_n_} = substr(original{_n_}, 1, length(original{_n_})-9);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if substr(original{_n_}, length(original{_n_}), 1) = ':' then substr(original{_n_}, length(original{_n_}), 1) = ' ';&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's untested, but I think I got the parentheses in the proper place.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 15:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326017#M72563</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-19T15:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326018#M72564</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another variation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
S1='1234b8:r:20060607';
S2=substr(S1,lengthn(S1)-7);
substr(S1,lengthn(S1)-7)='';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Using the substr function on left of =&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More on this here:&amp;nbsp;&lt;A href="https://v8doc.sas.com/sashtml/lgref/z0212267.htm" target="_blank"&gt;https://v8doc.sas.com/sashtml/lgref/z0212267.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 15:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326018#M72564</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-19T15:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326037#M72566</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I propose this solution&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input var $50.;
cards;
1234b8:r:20060607
627::20071012
382027:l:20071212
182b::20070615
17293b:r:20081231
;run;


DATA test1 (keep=var: date);
format date yymmdd10.;
set test end=eof;
   length code $10.;
   IF _N_=1 THEN RE = PRXPARSE("/\:\d{8}/");
   retain RE;
   CALL PRXSUBSTR(RE,var,START,LENGTH); 
   IF START GT 0 THEN DO;    
   code = SUBSTRN(var,START + 1,LENGTH - 1); 
   date =input (code,yymmdd10.);
   var2=SUBSTRN(var,1,LENGTH(var) - LENGTH);
   output;
   end; 
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jan 2017 16:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326037#M72566</guid>
      <dc:creator>mansour_ibrahim</dc:creator>
      <dc:date>2017-01-19T16:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326288#M72640</link>
      <description>&lt;P&gt;Thank you all!&lt;/P&gt;&lt;P&gt;But all of the codes make my log file running full when they are used within an array.&lt;/P&gt;&lt;P&gt;Why is that and is there a solution for it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121073"&gt;@mansour_ibrahim&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Somehow it works fine for the first variable, but when used in an array, in the second variable the date sometimes isn't cut off.&lt;/P&gt;&lt;P&gt;Do you know why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ops_ko{i} is the variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA testila;&lt;BR /&gt;set test;&lt;BR /&gt;&lt;BR /&gt;array ops_ko ops_ko1-ops_ko100;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;array dat_ops dat_ops1-dat_ops100;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;do i=1 to 100;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if _N_=1 then RE = PRXPARSE("/\:\d{8}/"); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; retain RE;&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; &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;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; call PRXSUBSTR(RE,ops_ko{i},START,LENGTH);&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if START GT 0 then do;&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; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dat_ops{i} = SUBSTRN(ops_ko{i},START + 1,LENGTH - 1); &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ops_ko{i} = SUBSTRN(ops_ko{i},1,LENGTH(ops_ko{i}) - 9);&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&lt;BR /&gt;end;&lt;BR /&gt;drop i Start Length RE;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 14:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326288#M72640</guid>
      <dc:creator>sasseln</dc:creator>
      <dc:date>2017-01-20T14:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326293#M72642</link>
      <description>&lt;P&gt;Then your doing something other than the suggestions posted here. &amp;nbsp;My datastep above should be printed to the log, followed by three other text rows with note, and two rows of time taken to run. &amp;nbsp;Nothing more. &amp;nbsp;Without seeing your log/code we can't tell. &amp;nbsp;Is it your setup, are you running other things, are you printing something to log etc?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326293#M72642</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-20T15:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326299#M72644</link>
      <description>&lt;P&gt;Thanks for the fast reply!&lt;/P&gt;&lt;P&gt;I am only running this code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test1;&lt;BR /&gt;&amp;nbsp; set test;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; array ops_ko ops_ko1-ops_ko100;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; array dat_ops dat_ops1-dat_ops100;&lt;BR /&gt;&amp;nbsp; do i=1 to 100;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; dat_ops{i}=substr(ops_ko{i},lengthn(ops_ko{i})-7,10);&lt;BR /&gt;&amp;nbsp; ops_ko{i}=tranwrd(ops_ko{i},strip(dat_ops{i}),"");&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326299#M72644</guid>
      <dc:creator>sasseln</dc:creator>
      <dc:date>2017-01-20T15:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326311#M72646</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input  @1 var $17. @18 var1 $20.;
cards;
1234b8:r:20060607 1234b8:r:20060607
152::20071012     627::20091012
382027:l:20071212 382027:l:20051212
182b::20070615    182b::20010615
17293b:r:20081231 17293b:r:20001231
;run;

DATA test1;
format date date1 yymmdd10.; 
set test;
array vr (*) $ var var1; 
array cd (*) $ code code1;
array dt(*) $ date date1;
array pr (*) $ prt1 prt2;  
do i=1 to dim(vr);
   if _N_=1 then RE = PRXPARSE("/\:\d{8}/");             
   retain RE;                                            
   call PRXSUBSTR(RE,vr(i),START,LENGTH);              
   if START GT 0 then do;                                
   cd{i} = SUBSTRN(vr{i},START + 1,LENGTH - 1);
   dt(i) =input (cd(i),yymmdd10.);
   pr(i)=SUBSTRN(vr(i),1,LENGTH(vr(i)) - LENGTH);
      
   end;
end;
drop i Start Length RE;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326311#M72646</guid>
      <dc:creator>mansour_ibrahim</dc:creator>
      <dc:date>2017-01-20T15:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326320#M72650</link>
      <description>&lt;P&gt;What is the rule that excludes data from the row with 627::20071012?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:54:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326320#M72650</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-20T15:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326334#M72655</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input  @1 var $17. @18 var1 $20.;
cards;
1234b8:r:20060607 1234b8:r:20060607
152::20071012     627:r:20091012
382027:l:20071212 382027::20051212
182b::20070615    182b::20010615
17293b:r:20081231 17293b:r:20001231
;run;

DATA test1;
format date date1 yymmdd10.; 
set test;
array vr (*) $ var var1; 
array cd (*) $ code code1;
array dt(*) $ date date1;
array pr (*) $ prt1 prt2;  
do i=1 to dim(vr);
   if _N_=1 then RE = PRXPARSE("/\:\d{8}/"); RX=PRXPARSE("/\d+\:{2}\d{8}/");             
   retain RE RX;
   if prxmatch(RX, vr(i)) = 0 then do;
   call PRXSUBSTR(RE,vr(i),START,LENGTH);              
   if START GT 0 then do;                                
   cd{i} = SUBSTRN(vr{i},START + 1,LENGTH - 1);
   dt(i) =input (cd(i),yymmdd10.);
   pr(i)=SUBSTRN(vr(i),1,LENGTH(vr(i)) - LENGTH);
      
   end;
   end;
end;
drop i Start Length RE RX;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 16:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326334#M72655</guid>
      <dc:creator>mansour_ibrahim</dc:creator>
      <dc:date>2017-01-20T16:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326348#M72658</link>
      <description>&lt;P&gt;Can you post the log? &amp;nbsp;Are you getting lots of notes or something?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 17:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326348#M72658</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-20T17:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326349#M72659</link>
      <description>&lt;P&gt;Can you post the log? &amp;nbsp;Are you getting lots of notes or something?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 17:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326349#M72659</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-20T17:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326651#M72791</link>
      <description>&lt;P&gt;Hi mansour_ibrahim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for the code! But now it exclusively cuts the data with an l or r in between.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 09:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326651#M72791</guid>
      <dc:creator>sasseln</dc:creator>
      <dc:date>2017-01-23T09:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326652#M72792</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test2;&lt;BR /&gt;&amp;nbsp; set test;&lt;BR /&gt;&amp;nbsp; array ops_ko ops_ko1-ops_ko100;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; array dat_ops dat_ops1-dat_ops100;&lt;BR /&gt;&amp;nbsp; do i=1 to 100;&lt;BR /&gt;&amp;nbsp; *length ops_ko date $50;&lt;BR /&gt;&amp;nbsp; dat_ops{i}=substr(ops_ko{i},lengthn(ops_ko{i})-7,10);&lt;BR /&gt;&amp;nbsp; ops_ko{i}=substr(ops_ko{i},1,lengthn(ops_ko{i})-8);&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326652#M72792</guid>
      <dc:creator>sasseln</dc:creator>
      <dc:date>2017-01-23T10:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326653#M72793</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&lt;/P&gt;&lt;P&gt;This one in the code fo RW9:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dat_ops{i}=substr(ops_ko{i},lengthn(ops_ko{i})-7,10);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for mansour_ibrhaim:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if _N_=1 then RE = PRXPARSE("/\:\d{8}/"); RX=PRXPARSE("/\d+\:{2}\d{8}/");&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; retain RE RX;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if prxmatch(RX, ops_ko(i)) = 0 then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; call PRXSUBSTR(RE,ops_ko(i),START,LENGTH);&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;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if START GT 0 then do;&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;&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;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; cd{i} = SUBSTRN(ops_ko{i},START + 1,LENGTH - 1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dt(i) =input (cd(i),yymmdd10.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; pr(i)=SUBSTRN(ops_ko(i),1,LENGTH(ops_ko(i)) - LENGTH);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326653#M72793</guid>
      <dc:creator>sasseln</dc:creator>
      <dc:date>2017-01-23T10:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326655#M72794</link>
      <description>&lt;P&gt;Sorry, you have actually posted the bit of the log right between important bits. &amp;nbsp;I am specifically looking at notes/errors/warnings. &amp;nbsp;The reason being is this kind of output occurs when you substr invalid data, or input invalid numeric data or something along those lines. &amp;nbsp;What SAS does is print out all the data for that observation where that error occurs, hence as all your data seems to have the same problem, i.e. a logic problem, then you are getting large amounts of output in the log.&lt;/P&gt;
&lt;P&gt;It is likely down to your array statements:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; array ops_ko ops_ko1-ops_ko100;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;These create numeric arrays, and you are trying to put substring information into them. &amp;nbsp;Try chaning to something like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; array ops_ko $200. ops_ko1-ops_ko100;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also note, this is a very good example of &lt;STRONG&gt;why it is recommended to post test data - in the form of a datastep&amp;nbsp;-&lt;/STRONG&gt; so that we can see exactly what you are working with. &amp;nbsp;I do not see what you do, nor can I run what you are running! &amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326655#M72794</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-23T10:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting &amp; deleting characters from string in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326671#M72800</link>
      <description>&lt;P&gt;It looks like it is as you said a problem with invalid data.&lt;/P&gt;&lt;P&gt;I ran your array but I has the same effect, but I found an important bit in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dat_ops95=&amp;nbsp; dat_ops96=&amp;nbsp; dat_ops97=&amp;nbsp; dat_ops98=&amp;nbsp; dat_ops99=&amp;nbsp; dat_ops100=&amp;nbsp; i=101 _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: Ungültiges zweites Argument für Funktion SUBSTR in Zeile 2371 Spalte 14. &lt;U&gt;--&amp;gt; translated: Invalid second argument for the function substr&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE: Over 100 NOTES, additional NOTES suppressed.&lt;BR /&gt;NOTE: Ungültiges zweites Argument für Funktion SUBSTR in Zeile 2371 Spalte 14. &lt;U&gt;--&amp;gt; translated: Invalid second argument for the function substr&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data look like this, for the variables ops_ko1 till ops_ko100 and fromatted as $CHAR19. :&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="left"&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;1234b8:r:20060607&lt;/P&gt;&lt;P&gt;627::20071012&lt;/P&gt;&lt;P&gt;382027:l:20071212&lt;/P&gt;&lt;P&gt;182b::20071615&lt;/P&gt;&lt;P&gt;17293b:r:20081281&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cutting-amp-deleting-characters-from-string-in-an-array/m-p/326671#M72800</guid>
      <dc:creator>sasseln</dc:creator>
      <dc:date>2017-01-23T10:48:18Z</dc:date>
    </item>
  </channel>
</rss>

