<?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 Reading multiple observations of a variable withour delimiter or space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576787#M163316</link>
    <description>&lt;P&gt;Given a dataset wherein we have one variable EmployeeData contains contains the data as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EmployeeData&lt;/P&gt;&lt;P&gt;Ravi27Kumar&lt;/P&gt;&lt;P&gt;Avinash29Sharma&lt;/P&gt;&lt;P&gt;Jitender25Singh&lt;/P&gt;&lt;P&gt;Anu26Sirohi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want data be splitted in 3 variables&amp;nbsp;FirstName Age LastName. Please advise&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ravi 27 Kumar&lt;BR /&gt;Avinash 29 Sharma&lt;BR /&gt;Jitender 25 Singh&lt;BR /&gt;Anu 26 Sirohi&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jul 2019 03:06:03 GMT</pubDate>
    <dc:creator>rvksharma</dc:creator>
    <dc:date>2019-07-26T03:06:03Z</dc:date>
    <item>
      <title>Reading multiple observations of a variable withour delimiter or space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576787#M163316</link>
      <description>&lt;P&gt;Given a dataset wherein we have one variable EmployeeData contains contains the data as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EmployeeData&lt;/P&gt;&lt;P&gt;Ravi27Kumar&lt;/P&gt;&lt;P&gt;Avinash29Sharma&lt;/P&gt;&lt;P&gt;Jitender25Singh&lt;/P&gt;&lt;P&gt;Anu26Sirohi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want data be splitted in 3 variables&amp;nbsp;FirstName Age LastName. Please advise&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ravi 27 Kumar&lt;BR /&gt;Avinash 29 Sharma&lt;BR /&gt;Jitender 25 Singh&lt;BR /&gt;Anu 26 Sirohi&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 03:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576787#M163316</guid>
      <dc:creator>rvksharma</dc:creator>
      <dc:date>2019-07-26T03:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple observations of a variable withour delimiter or space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576789#M163318</link>
      <description>One way:&lt;BR /&gt;&lt;BR /&gt;First name = scan(employeedata, 1, '0123456789' ) ;&lt;BR /&gt;Last_name = scan(employeedata, 2, '0123456789' ) ;&lt;BR /&gt;Age = compress(employeedata,,'kd' ) ;&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Jul 2019 03:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576789#M163318</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-07-26T03:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple observations of a variable withour delimiter or space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576802#M163320</link>
      <description>&lt;P&gt;In future post your code using the Insert SAS Code icon, using datalines. I have converted your "code" (text actually) only because it was trivial and didn't take much effort.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's another approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input EmployeeData :$30.;
   datalines;
Ravi27Kumar
Avinash29Sharma
Jitender25Singh
Anu26Sirohi
;
run;

data want;
   rx=prxparse("/(.*?)(\d+)(.*)/o");
   set have;
   length FirstName $30 Age 8 LastName $30;
   if prxmatch(rx,strip(EmployeeData)) then do;
      FirstName   = prxposn(rx,1,EmployeeData);
      Age         = input(prxposn(rx,2,EmployeeData),best.);
      LastName    = prxposn(rx,3,EmployeeData);
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jul 2019 05:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576802#M163320</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-26T05:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple observations of a variable withour delimiter or space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576940#M163390</link>
      <description>&lt;P&gt;You might consider talking to whoever is providing data in that format, especially if this is actually business related and not some school exercise.&lt;/P&gt;
&lt;P&gt;Any data interchanged should have a description so that the users can actually use the file. If data files do not have a delimiter then something else needs to be provided so that you KNOW where values start and end such as start and end columns. Guessing that a digit separates names is unreliable in some formats as people are obnoxious and will name there children, or pick a name, such as 3 just to be funny/ cute/ obnoxious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A business process without an agreement as to how the file will be structured is likely to lead to numerous headaches.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 15:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/576940#M163390</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-26T15:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple observations of a variable withour delimiter or space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/577200#M163544</link>
      <description>This worked. Thanks so much</description>
      <pubDate>Sun, 28 Jul 2019 02:56:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-observations-of-a-variable-withour-delimiter-or/m-p/577200#M163544</guid>
      <dc:creator>rvksharma</dc:creator>
      <dc:date>2019-07-28T02:56:44Z</dc:date>
    </item>
  </channel>
</rss>

