<?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 read Raw data with embedded blank without increasing the space between two values? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251469#M47525</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
length id name colour  num1 num2 $ 200;
input;
  id=scan(_infile_,1,' ');
  colour=scan(_infile_,-3,' ');
  num1=scan(_infile_,-2,' ');
  num2=scan(_infile_,-1,' ');

call scan(_infile_,2,p1,l1,' ');
call scan(_infile_,-3,p2,l2,' ');
name=substr(_infile_,p1,p2-p1);
drop p1 p2 l1 l2;
cards;
1023 David Shaw red 189 165
1049 Amelia Serrano yellow 145 124   
1219 Alan Nance red 210 192  
1246 Ravi Sinha yellow 194 177   
1078 Ashley McKnight red 127 118   
1221 Jim Brown yellow 220 .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 22 Feb 2016 04:38:52 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-02-22T04:38:52Z</dc:date>
    <item>
      <title>How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251039#M47374</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I have the following Raw data&amp;amp;colon;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1023 David Shaw red 189 165&lt;BR /&gt;1049 Amelia Serrano yellow 145 124&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;1219 Alan Nance red 210 192&amp;nbsp;&amp;nbsp;&lt;BR /&gt;1246 Ravi Sinha yellow 194 177&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;1078 Ashley McKnight red 127 118&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;1221 Jim Brown yellow 220 .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd and 3rd value have to be read together as they are the part of single variable:&lt;/P&gt;&lt;P&gt;e.g. Full_name: David Shaw&lt;/P&gt;&lt;P&gt;Full_name: Amelia Serrano&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above mentioned Data do not have more then one space between any values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One method to read this type of data is to use &lt;STRONG&gt;modifier '&amp;amp;'&lt;/STRONG&gt; that changes the default delimiter from single space to double space.&lt;/P&gt;&lt;P&gt;One limitation of the above mentioned method is that the space between the value and the next value has to be 2 or more for succesful execution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However In this case we cannot increase the space between any of the value.&lt;/P&gt;&lt;P&gt;Please provide a method to read this type of Data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS version 9.2&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 07:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251039#M47374</guid>
      <dc:creator>jayantyad</dc:creator>
      <dc:date>2016-02-19T07:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251041#M47375</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
length
  id 8
  name1 name2 $10
  name $20
  colour $7
;
input
  id
  name1
  name2
  colour
  num1
  num2
;
name = catx(' ',name1,name2);
drop name1 name2;
cards;
1023 David Shaw red 189 165
1049 Amelia Serrano yellow 145 124   
1219 Alan Nance red 210 192  
1246 Ravi Sinha yellow 194 177   
1078 Ashley McKnight red 127 118   
1221 Jim Brown yellow 220 .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2016 07:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251041#M47375</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-19T07:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251073#M47380</link>
      <description>&lt;P&gt;There is one limitation if words in name will vary i.e. 2 , 3 and 4 words in that case it will not work.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 10:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251073#M47380</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2016-02-19T10:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251463#M47522</link>
      <description>&lt;P&gt;data test;&lt;BR /&gt;infile cards truncover;&lt;BR /&gt;input x $200.;&lt;BR /&gt;cards;&lt;BR /&gt;1023 David Shaw red 189 165&lt;BR /&gt;1049 Amelia Serrano yellow 145 124&lt;BR /&gt;1219 Alan Nance red 210 192&lt;BR /&gt;1246 Ravi Sinha yellow 194 177&lt;BR /&gt;1078 Ashley McKnight red 127 118&lt;BR /&gt;1221 Jim Brown yellow 220 .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data test2;&lt;BR /&gt;set test;&lt;BR /&gt;id=scan(x,1);&lt;BR /&gt;name=catx(" ",scan(x,2),scan(x,3));&lt;BR /&gt;color=scan(x,4);&lt;BR /&gt;no1=scan(x,5);&lt;BR /&gt;no2=scan(x,6);&lt;BR /&gt;drop x;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 03:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251463#M47522</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2016-02-22T03:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251469#M47525</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
length id name colour  num1 num2 $ 200;
input;
  id=scan(_infile_,1,' ');
  colour=scan(_infile_,-3,' ');
  num1=scan(_infile_,-2,' ');
  num2=scan(_infile_,-1,' ');

call scan(_infile_,2,p1,l1,' ');
call scan(_infile_,-3,p2,l2,' ');
name=substr(_infile_,p1,p2-p1);
drop p1 p2 l1 l2;
cards;
1023 David Shaw red 189 165
1049 Amelia Serrano yellow 145 124   
1219 Alan Nance red 210 192  
1246 Ravi Sinha yellow 194 177   
1078 Ashley McKnight red 127 118   
1221 Jim Brown yellow 220 .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Feb 2016 04:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251469#M47525</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-02-22T04:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251483#M47531</link>
      <description>&lt;P&gt;Then one needs to countw the _infile_ to determine the number of of words for the name, and assign the variables with input(scan(_infile,,),) accordingly.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 06:54:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251483#M47531</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-22T06:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251487#M47534</link>
      <description>As long as there a fixed mumber of "words" around the part with a variable number of words, the CALL SCAN() solution offered by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; answers the problem!&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Feb 2016 08:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251487#M47534</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2016-02-22T08:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Raw data with embedded blank without increasing the space between two values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251689#M47599</link>
      <description>&lt;P&gt;Peter.C,&lt;/P&gt;
&lt;P&gt;Of course. If one of num1 and num2 is missing( a blank ), How do you know it is belong to num1 or num2 ?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 01:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-Raw-data-with-embedded-blank-without-increasing-the/m-p/251689#M47599</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-02-23T01:15:43Z</dc:date>
    </item>
  </channel>
</rss>

