<?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 Text File Import force the correct Informat and format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281701#M57156</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a data warehouse by imorting daily text files into SAS work.&amp;nbsp; and then combining the individual SAS tables into one large table.&amp;nbsp;&amp;nbsp;&amp;nbsp;A month&amp;nbsp;has 20 work days and hence, 20 text files for JUNE.&amp;nbsp; The code that I have&amp;nbsp;works almost all of the time.&amp;nbsp; However, the 17th of 20 files is not interpreting the "Settlement Date" correctly.&amp;nbsp; All fo the other files use&amp;nbsp; Date MMDDYY10 for the format and Informat.&amp;nbsp; The 17th file, however, is using Character $1 and $1 respectively (and truncating my dates).&amp;nbsp; The source data has settlement dates in it but also many empty fields too.&amp;nbsp; I am guessing that SAS is using, positionally, a field that is empty to get the $1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I manually import the file of the 17th, it correctly interprets "Settlemet Date" as&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Settlement Date'n&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I, for all files to use "Date:&amp;nbsp; MMDDYY10" when creating the imported SAS table?&lt;/P&gt;&lt;P&gt;Here is the import code that I am using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* IMPORT */&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;PROC IMPORT OUT= WORK.Loan_Detail_&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;i.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;DATAFILE= &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/sas/sasperm3_prod/RiskInfrastructure/XXXXX/LoanDetail/&amp;amp;Name.txt"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;DBMS=DLM REPLACE;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;DELIMITER=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'|'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;GETNAMES=YES;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;DATAROW=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Jul 2016 12:39:18 GMT</pubDate>
    <dc:creator>Kody_devl</dc:creator>
    <dc:date>2016-07-01T12:39:18Z</dc:date>
    <item>
      <title>Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281701#M57156</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a data warehouse by imorting daily text files into SAS work.&amp;nbsp; and then combining the individual SAS tables into one large table.&amp;nbsp;&amp;nbsp;&amp;nbsp;A month&amp;nbsp;has 20 work days and hence, 20 text files for JUNE.&amp;nbsp; The code that I have&amp;nbsp;works almost all of the time.&amp;nbsp; However, the 17th of 20 files is not interpreting the "Settlement Date" correctly.&amp;nbsp; All fo the other files use&amp;nbsp; Date MMDDYY10 for the format and Informat.&amp;nbsp; The 17th file, however, is using Character $1 and $1 respectively (and truncating my dates).&amp;nbsp; The source data has settlement dates in it but also many empty fields too.&amp;nbsp; I am guessing that SAS is using, positionally, a field that is empty to get the $1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I manually import the file of the 17th, it correctly interprets "Settlemet Date" as&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Settlement Date'n&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I, for all files to use "Date:&amp;nbsp; MMDDYY10" when creating the imported SAS table?&lt;/P&gt;&lt;P&gt;Here is the import code that I am using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/* IMPORT */&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;PROC IMPORT OUT= WORK.Loan_Detail_&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;i.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;DATAFILE= &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/sas/sasperm3_prod/RiskInfrastructure/XXXXX/LoanDetail/&amp;amp;Name.txt"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;DBMS=DLM REPLACE;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;DELIMITER=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'|'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;GETNAMES=YES;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;DATAROW=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281701#M57156</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-07-01T12:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281705#M57157</link>
      <description>&lt;P&gt;Whatever you do: proc import will only make a guess and try its best.&lt;/P&gt;
&lt;P&gt;If you want control of the process, take the data step generated by proc import (you find it in the log) and modify it to your needs. Sooner or later you won't use proc import any longer, as you will be quicker writing the step from scratch.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And do not name variables like &lt;FONT color="#800080" face="Courier New" size="3"&gt;'Settlement Date'n&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;Instead name them settlement_date. Saves a lot of typing and a lot of headaches.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281705#M57157</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-07-01T12:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281709#M57159</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you execute a proc import in the log is generated a data step that create your table. If all the tables have the same structure you could copy your data step and force certain formats changing the format and informat statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the log must appear something like&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.MYDATA    ;
   %let _EFIERR_ = 0; 
   infile 'C:\My Documents\myfiles\delimiter.txt' delimiter = '&amp;amp;' MISSOVER  DSD lrecl=32767 firstobs=2 ;
   informat Region $8. ;
   informat State $2. ;
   informat Month MONYY7. ;
   informat Expenses best32. ;
   informat Revenue best32. ;
   format Region $8. ;
   format State $2. ;
   format Month MONYY7. ;
   format Expenses best12. ;
   format Revenue best12. ;
input
            Region $
            State $
            Month
            Expenses
            Revenue
;
if _ERROR_ then call symputx('_EFIERR_',1);  
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281709#M57159</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2016-07-01T12:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281716#M57161</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I agree about no space headers and headaches!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 13:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281716#M57161</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-07-01T13:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281721#M57163</link>
      <description>&lt;P&gt;Correct, I have the code generated by the wizard&amp;nbsp;and it works but references an infile and import specification in the workspace location:&amp;nbsp; When I alter the file, I get the correct table structure, &amp;nbsp;but no data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INFILE&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'/sas/sasperm3_prod/RiskInfrastructure/xxxx/LoanDetail/LoanDetail 061016.txt'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/*&lt;/P&gt;&lt;P&gt;INFILE '/sas/grid/SAS_workE6A800002BD8_svcksa69901mpm/#LN00082'&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Funding Type'n&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;$CHAR9.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Fallout Function ID'n&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;BEST3.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;Mandatory &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;BEST7.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INFILE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'/sas/grid/SAS_workE6A800002BD8_svcksa69901mpm/#LN00082'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LRECL&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;393&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ENCODING&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"LATIN1"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TERMSTR&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=CRLF&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DLM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'7F'x&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;MISSOVER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DSD&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INPUT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Loan Number'n&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; : ?? &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;BEST10.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 13:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281721#M57163</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-07-01T13:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281730#M57165</link>
      <description>You have two infile statements. I think that only the fist should be used</description>
      <pubDate>Fri, 01 Jul 2016 14:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281730#M57165</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2016-07-01T14:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281735#M57167</link>
      <description>&lt;P&gt;The second statement is comment out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I included it to show how I changed the original code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 14:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281735#M57167</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-07-01T14:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281745#M57171</link>
      <description>&lt;P&gt;You would be much better off to to move all of the formats to in informat statements before the input instead of using inline format specifications especially with list input. The inline format specification will force reading all characters indicated by the lengths of the formats which will often lead to data issues with varying length values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also support the recommendations about not using the 'variable space'n constructs. Do however add Label statements to 1) document your variables and 2) provide nice headers and such in procedure output.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 15:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281745#M57171</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-01T15:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281751#M57174</link>
      <description>&lt;P&gt;The snippet you posted has two INFILE statements, one of which has a comment that includes part of another infile statement in it.&lt;/P&gt;
&lt;P&gt;PROC IMPORT tries to guess what your data is, but it generates really ugly SAS code that includes things like permanently attached $xx. formats that you would not want to have in your real dataset. &amp;nbsp;The general form for reading a delimited txt file is to define the variables, define the input location and then read the variables. &amp;nbsp;Define the variables explictly using either LENGTH or ATTRIB statement. Do not make the data step compiler guess as to what type and length to use for the variable based on how you reference it in the INPUT statement or what FORMAT or INFORMAT you first attach to it. &amp;nbsp;You only need to attach INFORMAT or FORMAT to variables that require them. &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
   length var1 $20 var2 8 var3 $40 .... ;
   format var2 date9.;
   informat var2 mmddyy10.;
   infile 'myfile.txt' dsd truncover firstobs=2;
   input var1 var2 var3 .... ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also if your input flenames follow a nice naming convention such that you can replace the day of the month with a wild card then you can read all of the files in one data step if you want. &amp;nbsp;You can use the EOV= option of the INFILE statement to make a variable that you can use to detect when a new file starts and skip the header row. &amp;nbsp;So for example if your file names look like '2016-06-01.txt', '2016-06-02.txt' etc. then you could do something like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile '/path/2016-06-*.txt' DSD TRUNCOVER FIRSTOBS=2 EOV=EOV;
input @;
if eov then input;
eov=0;
input ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 15:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281751#M57174</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-07-01T15:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281752#M57175</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I was able to TWEAK this line to make it work!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; _EFIERR_ &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'C:\My Documents\myfiles\delimiter.txt'&lt;/SPAN&gt; delimiter &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'&amp;amp;'&lt;/SPAN&gt; MISSOVER&amp;nbsp; DSD lrecl&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;32767&lt;/SPAN&gt; firstobs&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;informat&lt;/SPAN&gt; Region &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;8&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Change to: PIPE&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; _EFIERR_ &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'C:\My Documents\myfiles\delimiter.txt'&lt;/SPAN&gt; delimiter &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'|'&lt;/SPAN&gt; MISSOVER&amp;nbsp; DSD lrecl&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;32767&lt;/SPAN&gt; firstobs&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;informat&lt;/SPAN&gt; Region &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;8&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 15:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281752#M57175</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-07-01T15:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Text File Import force the correct Informat and format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281760#M57176</link>
      <description>&lt;P&gt;If all you changed was the delimiter then you can change that in the PROC IMPORT code usinging the DELIMITER= statement.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 16:09:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Text-File-Import-force-the-correct-Informat-and-format/m-p/281760#M57176</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-07-01T16:09:10Z</dc:date>
    </item>
  </channel>
</rss>

