<?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 txt file into SAS Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114466#M23574</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Should be simple to achieve (DSD option implies comma separated fields and takes care of unpacking quoted strings) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;infile ""c:\yourPath\yourFileName.txt" dsd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;length code $10 name $40 v1-v7 $1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;input code name v1-v7;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Sep 2012 21:23:38 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2012-09-06T21:23:38Z</dc:date>
    <item>
      <title>Converting txt file into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114464#M23572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have delimited txt file with 3 million records. I would like to convert into SAS Dataset. Please help me how can I do that ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sampele Text Records are below.&lt;/P&gt;&lt;P&gt;"0000012121","ROSE","N","N","N","N","N","N","N"&lt;/P&gt;&lt;P&gt;"0000002103","ROBT JENKINS","N","N","N","N","N","N","N"&lt;/P&gt;&lt;P&gt;"0000010111","ANA MAY NAG","N","N","N","N","N","N","N"&lt;/P&gt;&lt;P&gt;"0000010222","DAAA AA","N","N","N","N","N","N","N"&lt;/P&gt;&lt;P&gt;"0000011333","THAA C BLUUU HEEEEEEE","N","N","N","N","N","N","N"&lt;/P&gt;&lt;P&gt;"0000012444","MICCAAA SAAAAAAA","N","N","N","Y","Y","Y","Y"&lt;/P&gt;&lt;P&gt;"0000013555","PATTTTTT SMITH","Y","Y","Y","Y","Y","N","Y"&lt;/P&gt;&lt;P&gt;"0000013666","ELLMM BRAAAAA","N","N","N","N","N","N","N"&lt;/P&gt;&lt;P&gt;"1001113777","DOK A BAAA, JR.","N","N","N","N","N","N","N"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; 2nd field for some records, even in middle of the name, commas are there. Please suggest me how can I overcome this scenario while converting into SAS Dataset ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;S Ravuri.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 20:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114464#M23572</guid>
      <dc:creator>sambasiva_ravuri_tcs_com</dc:creator>
      <dc:date>2012-09-06T20:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114465#M23573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried proc import, via the point and click interface? If the comma's are within the quotation marks SAS will read it properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie File &amp;gt; Import Data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specify comma delimited&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 21:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114465#M23573</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-09-06T21:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114466#M23574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Should be simple to achieve (DSD option implies comma separated fields and takes care of unpacking quoted strings) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;infile ""c:\yourPath\yourFileName.txt" dsd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;length code $10 name $40 v1-v7 $1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;input code name v1-v7;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 21:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114466#M23574</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-09-06T21:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114467#M23575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also use proc import directly.&amp;nbsp; The critical thing you have to tell the code, in either case, is whether the file contains variable names.&amp;nbsp; Here is an example of the proc import code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC IMPORT OUT= WORK.want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAFILE= "C:\have.csv" &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBMS=CSV REPLACE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAROW=2; &lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 21:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114467#M23575</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-06T21:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114468#M23576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you use the Proc Import interface for comma delimited data as Reeza suggests, I would recommend going to the options and setting the guessing rows value to the maximum of 32767. The number of records is such that your second field might have a considerable number of values longer than might be found in the default first 20 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also recommend saving the code generated by proc import that will appear in the log as you may want to modify something and it is easier if you have a starting point. For instance, you don't mention if you have variable names in your file. If the are not on the first row of the file you are likely to end up with variables named Var1, Var2, Var3 ... You could change that in the code from the log to be meaningful such as Id, Name or what ever makes sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 21:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114468#M23576</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-09-06T21:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114469#M23577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How beautiful is the perfection of simplcity - especially when it is so aesthetically structured.&amp;nbsp; Kudos, sir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 20:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114469#M23577</guid>
      <dc:creator>JerryH</dc:creator>
      <dc:date>2012-09-10T20:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114470#M23578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;None of these answers are necessarily wrong - there are, indeed, correct.&amp;nbsp; However, regardless of the number of records, the KISS principle still reigns supreme.&amp;nbsp; The simplest answer is usally the best AND the most efficient.&amp;nbsp; PROC IMPORT has one advantage, perhaps, in that it includes the INFORMAT and FORMAT statements but in this case, given the simplicity of the records and the blessedness of the DSD option, it is an unnecessary complication to an otherwise very simple act.&amp;nbsp; Please remember, fellow SASsers - this is exactly what good old version 5.13 was built around - bullding SAS data sets from flat files.&amp;nbsp; It did the job just fine then and can do so now in v9.&amp;nbsp; Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 20:31:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-SAS-Dataset/m-p/114470#M23578</guid>
      <dc:creator>JerryH</dc:creator>
      <dc:date>2012-09-10T20:31:28Z</dc:date>
    </item>
  </channel>
</rss>

