<?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 import text with space delimiter and space is valid in the field? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28653#M6678</link>
    <description>neilxu &lt;BR /&gt;
 &lt;BR /&gt;
what are the rules that define the end of "comment"?&lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
    <pubDate>Sat, 06 Nov 2010 14:35:13 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2010-11-06T14:35:13Z</dc:date>
    <item>
      <title>How to import text with space delimiter and space is valid in the field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28649#M6674</link>
      <description>I have the following text:&lt;BR /&gt;
&lt;BR /&gt;
id1 string1 comment string2&lt;BR /&gt;
001  001   qwer asd   5&lt;BR /&gt;
002  002   asdfyuiop  6&lt;BR /&gt;
003  003   zxcv 5&lt;BR /&gt;
&lt;BR /&gt;
The problem is that space is the delimiter and also is the valid in comments. How can I import these?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 04 Nov 2010 16:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28649#M6674</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2010-11-04T16:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to import text with space delimiter and space is valid in the field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28650#M6675</link>
      <description>You will need to use a DATA step and parse the first, second fields, and then after finding the offset character to the third field using INDEXC possibly, then use SUBSTR along with the SAS special variable _INFILE_ to assign the final variable.&lt;BR /&gt;
&lt;BR /&gt;
Example:&lt;BR /&gt;
&lt;BR /&gt;
DATA ;&lt;BR /&gt;
INFILE &lt;FILEREF&gt; /* additional parameters as needed */ ;&lt;BR /&gt;
* LOAD THE INPUT BUFFER. ;&lt;BR /&gt;
INPUT ;&lt;BR /&gt;
* LENGTH OR ATTRIB statements go here. ;&lt;BR /&gt;
F1 = SCAN(_INFILE_,1," ");&lt;BR /&gt;
F2 = SCAN(_INFILE_,2," ");&lt;BR /&gt;
OFFSET = INDEXC(_INFILE_," ");&lt;BR /&gt;
OFFSET = INDEXC(SUBSTR(_INFILE_,OFFSET+1)," ");&lt;BR /&gt;
F3 = SUBSTR(_INFILE_,OFFSET+1);&lt;BR /&gt;
PUTLOG _ALL_;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/FILEREF&gt;</description>
      <pubDate>Thu, 04 Nov 2010 17:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28650#M6675</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-11-04T17:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to import text with space delimiter and space is valid in the field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28651#M6676</link>
      <description>Hi.&lt;BR /&gt;
You can input 'comment'  and 'string2' as one variable firstly, then parse this variable into two variables you need. try it.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
 input d1 $ string1 $ comment &amp;amp; $50.;&lt;BR /&gt;
 _comment=substr(comment,1,length(comment)-2);&lt;BR /&gt;
 string2=substr(comment,length(comment)-1);&lt;BR /&gt;
 drop comment;&lt;BR /&gt;
datalines;&lt;BR /&gt;
001 001 qwer asd 5&lt;BR /&gt;
002 002 asdfyuiop 6&lt;BR /&gt;
003 003 zxcv 5 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 05 Nov 2010 08:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28651#M6676</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-05T08:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to import text with space delimiter and space is valid in the field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28652#M6677</link>
      <description>INPUT logic in Ksharp reply supports a max of 1 blank-space between words in the comments.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 05 Nov 2010 12:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28652#M6677</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-11-05T12:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to import text with space delimiter and space is valid in the field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28653#M6678</link>
      <description>neilxu &lt;BR /&gt;
 &lt;BR /&gt;
what are the rules that define the end of "comment"?&lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
      <pubDate>Sat, 06 Nov 2010 14:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28653#M6678</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-11-06T14:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to import text with space delimiter and space is valid in the field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28654#M6679</link>
      <description>Emmm.Yes.&lt;BR /&gt;
If you have more than two blanks, you can use formatted input method.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
 infile datalines truncover;&lt;BR /&gt;
input d1 $ string1 $ comment  $50.;&lt;BR /&gt;
 _comment=substr(comment,1,anydigit(comment)-1);&lt;BR /&gt;
 string2=scan(comment,-1);&lt;BR /&gt;
 drop comment;&lt;BR /&gt;
datalines;&lt;BR /&gt;
001 001 qwer    asd 5&lt;BR /&gt;
002 002 asdfyuiop 6&lt;BR /&gt;
003 003 zxcv  sdit 5 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
P.S : The company is the one I worked for , not mine. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Mon, 08 Nov 2010 01:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-import-text-with-space-delimiter-and-space-is-valid-in/m-p/28654#M6679</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-08T01:17:30Z</dc:date>
    </item>
  </channel>
</rss>

