<?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: want to create three variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736327#M229366</link>
    <description>&lt;P&gt;Have you used regular expressions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have_want;
    length 
        first_name last_name $ 40 
        id $ 10
    ;
    
    rx = prxparse('/(\D+)(\d+)(\D+)/');
    
    a ='rahul99yadav';
    
    if prxmatch(rx, a) then do;
        first_name = prxposn(rx, 1, a);
        id = prxposn(rx, 2, a);
        last_name = prxposn(rx, 3, a);       
    end;
    
    drop rx;
run;
    &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Apr 2021 05:10:53 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-04-22T05:10:53Z</dc:date>
    <item>
      <title>want to create three variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736321#M229360</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to create three variable using a string&amp;nbsp;&lt;/P&gt;&lt;P&gt;a ='rahul99yadav'&lt;/P&gt;&lt;P&gt;output should be&lt;/P&gt;&lt;P&gt;first_name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;last_name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Id&lt;/P&gt;&lt;P&gt;rahul&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;yadav&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 99&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 04:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736321#M229360</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2021-04-22T04:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: want to create three variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736323#M229362</link>
      <description>&lt;P&gt;I do not know what structure your data have, but how about this?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
    length x $200.;
    input x $;
    datalines;
    taro01yamada
    gonbe02nanashi
    ;
run;


data test_1;
    set test;


    attrib first last id length=$200.;


    v=verify(x, "abccdefghijklmnopqrstuvwxyz");


    first=substr(x, 1, verify(x, "abccdefghijklmnopqrstuvwxyz")-1);
    last=substr(substr(x, verify(x, "abccdefghijklmnopqrstuvwxyz")), verify(substr(x, verify(x, "abcdefghijklmnopqrstuvwxyz")), "0123456789"));
    id=substr(substr(x, verify(x, "abccdefghijklmnopqrstuvwxyz")), 1, verify(substr(x, verify(x, "abcdefghijklmnopqrstuvwxyz")), "0123456789")-1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 04:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736323#M229362</guid>
      <dc:creator>KentaMURANAKA</dc:creator>
      <dc:date>2021-04-22T04:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: want to create three variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736326#M229365</link>
      <description>&lt;P&gt;please try this code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length a $200;
  input a;
datalines;
rahul99yadav
;
run;

data want;
  set have;
  length first_name $20 last_name $20 Id $8;
  first_name=scan(a,1,,'d');
  last_name =scan(a,2,,'d');
  Id=scan(a,1,,'dk');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 05:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736326#M229365</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-04-22T05:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: want to create three variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736327#M229366</link>
      <description>&lt;P&gt;Have you used regular expressions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have_want;
    length 
        first_name last_name $ 40 
        id $ 10
    ;
    
    rx = prxparse('/(\D+)(\d+)(\D+)/');
    
    a ='rahul99yadav';
    
    if prxmatch(rx, a) then do;
        first_name = prxposn(rx, 1, a);
        id = prxposn(rx, 2, a);
        last_name = prxposn(rx, 3, a);       
    end;
    
    drop rx;
run;
    &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 05:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736327#M229366</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-04-22T05:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: want to create three variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736330#M229370</link>
      <description>&lt;P&gt;Thanks a ton&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 05:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736330#M229370</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2021-04-22T05:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: want to create three variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736378#M229393</link>
      <description>&lt;P&gt;Does it exactly have three variables ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
    length x $200.;
    input x $;
    datalines;
    taro01yamada
    gonbe02nanashi
    ;
run;

data want;
 set test;
 v1=scan(x,1,,'d');
 v2=scan(x,2,,'d');
 v3=scan(x,1,,'kd');
run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 11:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736378#M229393</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-22T11:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: want to create three variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736446#M229418</link>
      <description>Thanks a ton</description>
      <pubDate>Thu, 22 Apr 2021 16:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-create-three-variable/m-p/736446#M229418</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2021-04-22T16:00:18Z</dc:date>
    </item>
  </channel>
</rss>

