<?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: extraction chaine de caracteres in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329720#M271788</link>
    <description>Thank you ! It works perfectly for me</description>
    <pubDate>Fri, 03 Feb 2017 09:10:51 GMT</pubDate>
    <dc:creator>roll4life</dc:creator>
    <dc:date>2017-02-03T09:10:51Z</dc:date>
    <item>
      <title>extraction chaine de caracteres</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329442#M271784</link>
      <description>&lt;P&gt;Bonsoir,&lt;BR /&gt;&lt;BR /&gt;Je débutes avec SAS ET J'aimerais extraire une partie d'une chaine de caractères qui se présente dans un tableau comme suit&lt;BR /&gt;Col1 Col2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Col3&lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bismuth&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WZ2801201714515390972268&amp;lt;/cp_check_id&amp;gt;&lt;FONT color="#FF0000"&gt;&amp;lt;result&amp;gt;0&amp;lt;/result&amp;gt;&lt;/FONT&gt;&amp;lt;vart_id&amp;gt;01.269821&amp;lt;&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Gandhi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cp_reply&amp;gt;&amp;lt;cp_id&amp;gt;TOPCPID&amp;lt;/cd&amp;gt;&amp;lt;cp_tr_id&amp;gt;&lt;FONT color="#FF0000"&gt;&amp;lt;result&amp;gt;21&amp;lt;/result&amp;gt;&lt;/FONT&gt;credit_bal&amp;gt;&amp;lt;end_val_daten&lt;BR /&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILLON&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01010CPUSSDGWID02024WZ2801201718562191813204050101485629752210010&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;result&amp;gt;15&amp;lt;/result&amp;gt;801244522584256219181&lt;BR /&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; PENELOPE 4WZ2801&lt;FONT color="#FF0000"&gt;&amp;lt;result&amp;gt;5&amp;lt;/result&amp;gt;&lt;/FONT&gt;&amp;lt;2017&amp;lt;end_val_date&amp;gt;19/07/2025&amp;lt;/end_val_date&amp;gt;&amp;lt;end_inact_date&amp;gt;18/01/2038&amp;lt;&lt;BR /&gt;&lt;BR /&gt;la longueur de la Col3 est variante, je veux donc extraire dans une autre table les Col1 Col2et le résultat de la Col3 qui est toujours délimité par &amp;lt;result&amp;gt;&lt;FONT color="#FF0000"&gt;12&lt;/FONT&gt;&amp;lt;/result&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Merci à tous pour vos réponses.&lt;BR /&gt;&lt;BR /&gt;Cordialement&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 14:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329442#M271784</guid>
      <dc:creator>roll4life</dc:creator>
      <dc:date>2017-02-02T14:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: extraction chaine de caracteres</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329468#M271785</link>
      <description>&lt;P&gt;There might be a more direct route, but the following will work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  informat Col2 $8.;
  informat Col3 $char80.;
  input Col1 Col2 Col3 &amp;amp;;
  cards;
1 bismuth WZ2801201714515390972268 &amp;lt;/ cp_check_id&amp;gt; &amp;lt;result&amp;gt; 0 &amp;lt;/ result&amp;gt; &amp;lt;vart_id&amp;gt; 01.269821 &amp;lt;
2 Gandhi &amp;lt;cp_reply&amp;gt; &amp;lt;cp_id&amp;gt; TOPCPID &amp;lt;/ cd&amp;gt; &amp;lt;cp_tr_id&amp;gt; &amp;lt;result&amp;gt; 21 &amp;lt;/ result&amp;gt; credit_bal&amp;gt; &amp;lt;end_val_daten
3 FILLON 01010CPUSSDGWID02024WZ2801201718562191813204050101485629752210010&amp;gt; &amp;lt;result&amp;gt; 15 &amp;lt;/ result&amp;gt; 801244522584256219181
4 PENELOPE 4WZ2801 &amp;lt;result&amp;gt; 5 &amp;lt;/ result&amp;gt; &amp;lt;2017 &amp;lt;end_val_date&amp;gt; 19/07/2025 &amp;lt;/ end_val_date&amp;gt; &amp;lt;end_inact_date&amp;gt; 18/01/2038 &amp;lt;
;

data want;
  set have;
  result=input(scan(substr(col3,find(col3,'&amp;lt;result&amp;gt;')+8),1,'&amp;lt;'),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, 02 Feb 2017 15:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329468#M271785</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-02T15:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: extraction chaine de caracteres</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329516#M271786</link>
      <description>&lt;P&gt;Bonjour,&lt;/P&gt;&lt;P&gt;Je te propose une autre solution:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  informat Col2 $8.;
  informat Col3 $char80.;
  input Col1 Col2 Col3 &amp;amp;;
  cards;
1 bismuth WZ2801201714515390972268 &amp;lt;/ cp_check_id&amp;gt; &amp;lt;result&amp;gt; 0 &amp;lt;/ result&amp;gt; &amp;lt;vart_id&amp;gt; 01.269821 &amp;lt;
2 Gandhi &amp;lt;cp_reply&amp;gt; &amp;lt;cp_id&amp;gt; TOPCPID &amp;lt;/ cd&amp;gt; &amp;lt;cp_tr_id&amp;gt; &amp;lt;result&amp;gt; 21 &amp;lt;/ result&amp;gt; credit_bal&amp;gt; &amp;lt;end_val_daten
3 FILLON 01010CPUSSDGWID02024WZ2801201718562191813204050101485629752210010&amp;gt; &amp;lt;result&amp;gt; 15 &amp;lt;/ result&amp;gt; 801244522584256219181
4 PENELOPE 4WZ2801 &amp;lt;result&amp;gt; 5&amp;lt;/ result&amp;gt; &amp;lt;2017 &amp;lt;end_val_date&amp;gt; 19/07/2025 &amp;lt;/ end_val_date&amp;gt; &amp;lt;end_inact_date&amp;gt; 18/01/2038 &amp;lt;
;

DATA test1(keep=col: resultat);
set have;
   if _N_=1 then RE = PRXPARSE("/\d+ ?\&amp;lt;\/ result\&amp;gt;/");            
   retain RE ;
   if PRXMATCH(RE,col3) &amp;gt; 0 then do;
   call PRXSUBSTR(RE,col3,START,LENGTH); 
   resultat = SUBSTRN(col3,START ,LENGTH);
   RX=PRXPARSE("s/\&amp;lt;\/ result\&amp;gt;/ /");
   CALL PRXCHANGE(RX,-1,resultat); 
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Cordialement&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 17:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329516#M271786</guid>
      <dc:creator>mansour_ibrahim</dc:creator>
      <dc:date>2017-02-02T17:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: extraction chaine de caracteres</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329523#M271787</link>
      <description>&lt;P&gt;Ou plus simplement :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
if not prxId then prxId + prxParse("#&amp;lt;result&amp;gt;(.*)&amp;lt;/result&amp;gt;#i");
set have;
if prxMatch(prxId, col3) then
    valeur = input(prxPosn(prxId, 1, col3), best.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Feb 2017 18:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329523#M271787</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-02T18:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: extraction chaine de caracteres</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329720#M271788</link>
      <description>Thank you ! It works perfectly for me</description>
      <pubDate>Fri, 03 Feb 2017 09:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extraction-chaine-de-caracteres/m-p/329720#M271788</guid>
      <dc:creator>roll4life</dc:creator>
      <dc:date>2017-02-03T09:10:51Z</dc:date>
    </item>
  </channel>
</rss>

