<?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 txt file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185929#M47211</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;As far as I am aware there is no method in proc import to set lengths.&amp;nbsp; The reason is that proc import is a wrapper.&amp;nbsp; Behind the scenes it is guessing what your data is and generating a datastep import program.&amp;nbsp; This import program is normally written to the log for text files, so you can take that code that is generated and modify it as you want.&amp;nbsp; IMO its not a good idea to use proc import as it "guesses" what its to do.&amp;nbsp; You know the data so are best placed to tell the code what to do.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There may also be a couple of other things you want to be sure of, is the delimiter really 09X?&amp;nbsp; Does the strings contain special characters etc.&amp;nbsp; I would recommend a CSV format file with quoted strings to be safer, or if you want to go the whole hog, then XML.&amp;nbsp; Are you saving from Excel perhaps?&amp;nbsp; If so then you can just save as CSV from there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Feb 2015 11:55:19 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-02-27T11:55:19Z</dc:date>
    <item>
      <title>how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185928#M47210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;i have a small doubt. There is one txt file.&lt;/P&gt;&lt;P&gt;To import it into&amp;nbsp; sas i used proc import method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile="D:\sample.txt"&lt;/P&gt;&lt;P&gt;out=ds&lt;/P&gt;&lt;P&gt;dbms=dlm&lt;/P&gt;&lt;P&gt;replace;&lt;/P&gt;&lt;P&gt;delimiter='09'X;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;By using this method some of the variables length is missing.&lt;/P&gt;&lt;P&gt;Suppose between variables here i mention i mention two variables. i.e. company name and sub branch company name.&lt;/P&gt;&lt;P&gt;Both are character variables.&lt;/P&gt;&lt;P&gt;sub branch length is 40 and it reads it completely.&lt;/P&gt;&lt;P&gt;But company name variable length is missing. its taking only 10.of&lt;/P&gt;&lt;P&gt;I don't know why its taken like that.&lt;/P&gt;&lt;P&gt;Is there any method to while reading the data from txt file to mention the length of variable. Is this possible in Proc Import.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 11:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185928#M47210</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-02-27T11:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185929#M47211</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;As far as I am aware there is no method in proc import to set lengths.&amp;nbsp; The reason is that proc import is a wrapper.&amp;nbsp; Behind the scenes it is guessing what your data is and generating a datastep import program.&amp;nbsp; This import program is normally written to the log for text files, so you can take that code that is generated and modify it as you want.&amp;nbsp; IMO its not a good idea to use proc import as it "guesses" what its to do.&amp;nbsp; You know the data so are best placed to tell the code what to do.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There may also be a couple of other things you want to be sure of, is the delimiter really 09X?&amp;nbsp; Does the strings contain special characters etc.&amp;nbsp; I would recommend a CSV format file with quoted strings to be safer, or if you want to go the whole hog, then XML.&amp;nbsp; Are you saving from Excel perhaps?&amp;nbsp; If so then you can just save as CSV from there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 11:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185929#M47211</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-27T11:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185930#M47212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would adding the GUESSING rows option/statement fix your problem.&amp;nbsp; Have you looked at the documentation for PROC IMPORT?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 13:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185930#M47212</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-02-27T13:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185931#M47213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GUESSING ROWS is worked in excel. here the data is tab delimited data. if the two variables having large size then some of the variables length is missing&lt;/P&gt;&lt;P&gt;so using proc import it is possible to mention length of variables while importing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 07:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185931#M47213</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-03-02T07:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185932#M47214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to RTM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #e7e7e5;"&gt;The GUESSINGROWS statement is valid only for delimited files.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 09:49:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185932#M47214</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-03-02T09:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185933#M47215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try using CSV as dbms. If this doesn't work , i think you need to check the data and why its getting truncated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile="D:\sample.txt"&lt;/P&gt;&lt;P&gt;out=ds&lt;/P&gt;&lt;P&gt;dbms=csv&lt;/P&gt;&lt;P&gt;replace;&lt;/P&gt;&lt;P&gt;delimiter='09'X;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 10:05:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185933#M47215</guid>
      <dc:creator>Vish33</dc:creator>
      <dc:date>2015-03-02T10:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185934#M47216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i used your method vish33&amp;nbsp; Sir but same result i am getting. Although there is no changes in data using dbms=tab or&amp;nbsp; dbms=csv.&lt;/P&gt;&lt;P&gt;variables length is missing. all are character variables.&lt;/P&gt;&lt;P&gt;Is there any efficient method that while importing mention variables size.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 11:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185934#M47216</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-03-02T11:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185935#M47217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Delimiter option is not valid for DBMS=CSV, for obvious reasons.&lt;/P&gt;&lt;P&gt;'09'X is TAB. Try that as DBMS.&lt;/P&gt;&lt;P&gt;If that is not working for you, consider to use the data step instead, were you have complete control of field length etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 11:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185935#M47217</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-03-02T11:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185936#M47218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not an import but it reads txt files.&amp;nbsp;&amp;nbsp; My normal record is 77 bytes long;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data master; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile '/folders/myfolders/rawfiles/pre44.txt'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obs=99 length=rli&amp;nbsp; dlm=’09’x;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input dat: $varying200. rli @ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=rli;&amp;nbsp;&amp;nbsp; put _all_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF X = 77 THEN DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input @5 cat $10.&amp;nbsp; @15 desc $30. @47 yr $10.&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @54 c7&amp;nbsp; $8.&amp;nbsp; @64&amp;nbsp; c8 $8.&amp;nbsp;&amp;nbsp;&amp;nbsp; @70 c10 $8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 12:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185936#M47218</guid>
      <dc:creator>Jim_G</dc:creator>
      <dc:date>2015-03-02T12:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185937#M47219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When reading delimited files formatted input is not appropriate.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 12:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185937#M47219</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-03-02T12:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185938#M47220</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;Perhaps attach the sample.txt file (or a smaller version of it if it is large), so that we can see the data you're trying to read and show us what output you're seeing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you say "&lt;SPAN style="color: #575757; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; background-color: #ffffff;"&gt;But company name variable length is missing. its taking only 10.of&lt;/SPAN&gt;" Do you mean only the first 10 characters of company name are being read or only 10 fields are being read, or something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 13:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185938#M47220</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2015-03-02T13:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185939#M47221</link>
      <description>&lt;P&gt;Why are you using PROC IMPORT?&lt;/P&gt;
&lt;P&gt;If you know the data then just write a data step to read the file.&lt;/P&gt;
&lt;P&gt;Are you sure the file is tab delimited? Is it possible it is just a text file and the text editor has inserted random tabs where it thinks it can save space by replacing multiple spaces with a tab?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See: &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=n1w749t788cgi2n1txpuccsuqtro.htm&amp;amp;locale=en" target="_self"&gt;Reading Raw Data with the INPUT statement.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 12:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185939#M47221</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-05T12:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185940#M47222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank u for your valid comments. I follow data step infile statement to read the full length of variable. I used&amp;nbsp; colon":" before of every variable. Ex: company_name: $50.&lt;/P&gt;&lt;P&gt;So i got the result. Once again thank u all for spending time for my post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 12:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185940#M47222</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-03-03T12:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to import txt file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185942#M47224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please read&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="2263" __jive_macro_name="document" class="jive_macro jive_macro_document" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Mar 2015 05:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-import-txt-file/m-p/185942#M47224</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-08T05:17:18Z</dc:date>
    </item>
  </channel>
</rss>

