<?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: pipe delimited file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113492#M31423</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;data have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length level1 level2_code level2 $32;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;'' &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;lrecl&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;32767&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;firstobs&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;'|' missover&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; level1 level2_code level2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Oct 2013 20:18:06 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2013-10-15T20:18:06Z</dc:date>
    <item>
      <title>pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113488#M31419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to read a pipe delimited file.&amp;nbsp; And for some character variable, the value contains one or more blanks.&amp;nbsp; Although I specified that delimiter='|' in the infile, it seems like sas still treat blank as a secondary delimiter.&amp;nbsp; The result is it successfully delimit each variable, but for each value, sas cut off the part after the first blank.&amp;nbsp; How can I fix it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Akilees&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 18:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113488#M31419</guid>
      <dc:creator>akilees</dc:creator>
      <dc:date>2013-10-15T18:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113489#M31420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The option DSD on an infile statement usually works for this. The full code of what you're attempting would help.&lt;/P&gt;&lt;P&gt;It might also be that your character variables are defaulting to 8 characters and need to be longer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 19:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113489#M31420</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-10-15T19:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113490#M31421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;Thank you! Here is the code for reading the variables. Right, I should specify the length, but I don't know how long I should do, so I just estimate the longest possible value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;data have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'' &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;lrecl&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;32767&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;firstobs&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'|'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; level1 $ level2_code $ level2 $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 19:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113490#M31421</guid>
      <dc:creator>akilees</dc:creator>
      <dc:date>2013-10-15T19:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113491#M31422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But I just realized that the length has been assigned in lrecl=32767, right? why is it still truncating?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 20:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113491#M31422</guid>
      <dc:creator>akilees</dc:creator>
      <dc:date>2013-10-15T20:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113492#M31423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;data have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length level1 level2_code level2 $32;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;'' &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;lrecl&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;32767&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;firstobs&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;'|' missover&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; level1 level2_code level2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 20:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113492#M31423</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-10-15T20:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113493#M31424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;akilees wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;Thank you! Here is the code for reading the variables. Right, I should specify the length, but I don't know how long I should do, so I just estimate the longest possible value?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;data have;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'' &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;lrecl&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;32767&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;firstobs&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'|'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; level1 $ level2_code $ level2 $;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;lrecl is only defining the length of the total record.&amp;nbsp; You still need to define your character variables' length.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile a lrecl=32767 firstobs=2 dlm='|';&lt;/P&gt;&lt;P&gt; input level1 :$15. level2_code :$3. level2 :$15.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;(note the colons)&lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile a lrecl=32767 firstobs=2 dlm='|';&lt;/P&gt;&lt;P&gt;informat level1 level2 $15. level2_code $3.;&lt;/P&gt;&lt;P&gt;input level1 $ level2_code $ level2 $;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or use length or format similarly.&amp;nbsp; Length is somewhat better if you're just defining lengths and don't have informats for your variables (all plain characters); informat is somewhat more common if you do have some informats (date variables etc.) and matches what you see from PROC IMPORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One trick you can use is to PROC IMPORT, see what the proc import decides for lengths, and borrow that (look at your log).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 20:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113493#M31424</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-10-15T20:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113494#M31425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Snoopy!&amp;nbsp; I got the character length from the import procedure.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 19:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113494#M31425</guid>
      <dc:creator>akilees</dc:creator>
      <dc:date>2013-10-21T19:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113495#M31426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BTW, if import can do the job, what is data infile used for?&amp;nbsp; I guess both of them can read raw date files and specify the delimiter.&amp;nbsp; I tried to search the difference between them but didn't get a clear idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 19:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113495#M31426</guid>
      <dc:creator>akilees</dc:creator>
      <dc:date>2013-10-21T19:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113496#M31427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data step read gives you more control than PROC IMPORT; so if PROC IMPORT guesses wrong, or doesn't give you the result you need in terms of formats/informats, you should use data step read.&amp;nbsp; I typically only use PROC IMPORT as a helper (to give me a starting point) in my production code, as I worry PROC IMPORT may yield inconsistent results; but if you're okay with that possibility (if this is a one-time run, for example, or minor inconsistencies with length of text variables and such aren't important) and you're not doing complicated things with formats, you can just use PROC IMPORT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 20:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113496#M31427</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-10-21T20:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: pipe delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113497#M31428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for sharing!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 21:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pipe-delimited-file/m-p/113497#M31428</guid>
      <dc:creator>akilees</dc:creator>
      <dc:date>2013-10-21T21:10:01Z</dc:date>
    </item>
  </channel>
</rss>

