<?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: Converting Text Delimited file into a SAS Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Text-Delimited-file-into-a-SAS-Dataset/m-p/61841#M13456</link>
    <description>First add &lt;I&gt;dlm=';' dsd missover&lt;/I&gt; to your infile statement.&lt;BR /&gt;
dlm specifies the separator between fields.&lt;BR /&gt;
dsd says that you character data will be in quotes.&lt;BR /&gt;
missover will stop SAS to bother when reading pass the en of the line.&lt;BR /&gt;
&lt;BR /&gt;
Doing this, there is still a quote at the end of the DOCNAME column which I can't figure out how to eliminate (except for some dirty compress()/subtr action afterwards). But I'm sure there are some INFILE gurus out there who knows...&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
    <pubDate>Mon, 17 Nov 2008 20:24:53 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2008-11-17T20:24:53Z</dc:date>
    <item>
      <title>Converting Text Delimited file into a SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Text-Delimited-file-into-a-SAS-Dataset/m-p/61840#M13455</link>
      <description>I have a SAS job in which I am trying to take a text delimited dataset and converting it into a regular dataset -- getting ride of the "" and ;.  And lining up each column.  &lt;BR /&gt;
&lt;BR /&gt;
Following is the code I am currently using, but since it is a text delimited file, it does not line up appropriately or pull in the correct fields&lt;BR /&gt;
&lt;BR /&gt;
 DATA EMPS;                    &lt;BR /&gt;
  INFILE EJS;                  &lt;BR /&gt;
  INPUT                        &lt;BR /&gt;
  @   2 FOLDER   $4.           &lt;BR /&gt;
  @  48 SERIAL   $6.           &lt;BR /&gt;
  @  56 DATE     $8.           &lt;BR /&gt;
  @  66 DOCNAME  $20.;         &lt;BR /&gt;
                               &lt;BR /&gt;
 IF FOLDER = 'APPL';           &lt;BR /&gt;
 OPTIONS NOCENTER MISSING=' '; &lt;BR /&gt;
 DATA EMPS; SET EMPS;          &lt;BR /&gt;
 RUN;                          &lt;BR /&gt;
 PROC SORT; BY SERIAL;         &lt;BR /&gt;
 QUIT;                         &lt;BR /&gt;
 DATA _NULL_;                  &lt;BR /&gt;
 SET EMPS;                     &lt;BR /&gt;
 FILE OUT NOPRINT NOTITLE;     &lt;BR /&gt;
 PUT @1  SERIAL  6.            &lt;BR /&gt;
     @8  FOLDER  4.            &lt;BR /&gt;
     @12 DATE    8.    &lt;BR /&gt;
     @20 DOCNAME 20.;  &lt;BR /&gt;
 RUN;                  &lt;BR /&gt;
&lt;BR /&gt;
The data in the text delimited file looks like:&lt;BR /&gt;
&lt;BR /&gt;
"APPL";"ASCENT1";"A1001001A06K11B20419A97524";"999999";20060516;"Matters of Impo"&lt;BR /&gt;
"APPL";"ASCENT1";"A1001001A06K11B20421I87207";"999999";20060516;"Matters of Impo"&lt;BR /&gt;
&lt;BR /&gt;
and when I run the code above, it looks like:&lt;BR /&gt;
&lt;BR /&gt;
;"7339 APPL";200707"APPL";"4829#6897";" &lt;BR /&gt;
"A1230 APPL";200701"APPL";"ICMADMIN";"A &lt;BR /&gt;
&lt;BR /&gt;
Can someone help here?</description>
      <pubDate>Mon, 17 Nov 2008 18:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Text-Delimited-file-into-a-SAS-Dataset/m-p/61840#M13455</guid>
      <dc:creator>marief58</dc:creator>
      <dc:date>2008-11-17T18:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Text Delimited file into a SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Text-Delimited-file-into-a-SAS-Dataset/m-p/61841#M13456</link>
      <description>First add &lt;I&gt;dlm=';' dsd missover&lt;/I&gt; to your infile statement.&lt;BR /&gt;
dlm specifies the separator between fields.&lt;BR /&gt;
dsd says that you character data will be in quotes.&lt;BR /&gt;
missover will stop SAS to bother when reading pass the en of the line.&lt;BR /&gt;
&lt;BR /&gt;
Doing this, there is still a quote at the end of the DOCNAME column which I can't figure out how to eliminate (except for some dirty compress()/subtr action afterwards). But I'm sure there are some INFILE gurus out there who knows...&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 17 Nov 2008 20:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Text-Delimited-file-into-a-SAS-Dataset/m-p/61841#M13456</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-11-17T20:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Text Delimited file into a SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Text-Delimited-file-into-a-SAS-Dataset/m-p/61842#M13457</link>
      <description>I found this hen strolling around in the SAS doc. There is a possibility to use a variable length informat in the INPUT statement. I figure this will work all but one field are fixed length:&lt;BR /&gt;
&lt;BR /&gt;
DATA EMPS; &lt;BR /&gt;
	INFILE EJS dlm=';' dsd truncover &lt;I&gt;length=linelen&lt;/I&gt;;&lt;BR /&gt;
	INPUT &lt;BR /&gt;
	@ 2 FOLDER $4. &lt;BR /&gt;
	@ 48 SERIAL $6. &lt;BR /&gt;
	@ 56 DATE $8. @;&lt;BR /&gt;
&lt;BR /&gt;
	&lt;I&gt;varlen = linelen-66;&lt;/I&gt; &lt;BR /&gt;
	input @ 66 DOCNAME &lt;I&gt;$varying20. varlen&lt;/I&gt;; &lt;BR /&gt;
&lt;BR /&gt;
	IF FOLDER = 'APPL'; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Tue, 18 Nov 2008 21:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Text-Delimited-file-into-a-SAS-Dataset/m-p/61842#M13457</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-11-18T21:10:00Z</dc:date>
    </item>
  </channel>
</rss>

