<?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: Date informat problem? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64146#M13971</link>
    <description>Well it isn't necessarily a date problem. I am just getting the invalid data error. &lt;BR /&gt;
&lt;BR /&gt;
Shoooooot. This is bugging me big time.</description>
    <pubDate>Thu, 13 Aug 2009 13:44:13 GMT</pubDate>
    <dc:creator>Aar684</dc:creator>
    <dc:date>2009-08-13T13:44:13Z</dc:date>
    <item>
      <title>Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64142#M13967</link>
      <description>Hi all.&lt;BR /&gt;
&lt;BR /&gt;
I am trying to import a data set with multiple variables. I have no problem importing everything up until my date field. The data file is a .csv with an account number and a date per row of data followed by 24 columns (hours) of data. I am getting invalid data errors starting with date all the way through the 24 hours. I used yvar1-yvar24 for the hours in the day and date for my date field. My code looks like this:&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
	length rate$4. account $11. meter $11. channel $13. lrid $16. name $33. units $5. legacy $11.; &lt;BR /&gt;
	informat date mmddyy10.; array yvar yvar1-yvar24; &lt;BR /&gt;
&lt;BR /&gt;
	infile 'K:\LOAD RESEARCH\CLP Rate Case Test Year 07-01-08 to 06-30-09\CSV Files Dist Run\w Legacy\input\1.csv' lrecl=350 missover dlm=',';&lt;BR /&gt;
	&lt;BR /&gt;
	input account meter legacy channel lrid name units date mmddyy10. yvar1-yvar24;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The date in the csv file looks like this 07/18/2008. What am I doing wrong here?</description>
      <pubDate>Thu, 13 Aug 2009 11:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64142#M13967</guid>
      <dc:creator>Aar684</dc:creator>
      <dc:date>2009-08-13T11:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64143#M13968</link>
      <description>Try removing the "mmddyy10." from the INPUT statement (you shouldn't need this given the INFORMAT).&lt;BR /&gt;
&lt;BR /&gt;
Do &lt;B&gt;&lt;U&gt;all&lt;/U&gt;&lt;/B&gt; of your date fields fill out exactly 10 characters (i.e., have their leading zeros)?  If not (e.g., 08/5/2009), that might be the problem, but removing the "mmddyy10." should fix it.</description>
      <pubDate>Thu, 13 Aug 2009 13:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64143#M13968</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-13T13:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64144#M13969</link>
      <description>Unfortunately that did not fix it. Any other ideas? And yes, all of the dates fill out 10 characters.</description>
      <pubDate>Thu, 13 Aug 2009 13:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64144#M13969</guid>
      <dc:creator>Aar684</dc:creator>
      <dc:date>2009-08-13T13:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64145#M13970</link>
      <description>Not off the top of my head.  I could only force an error message by keeping your original code (i.e., before removing the extra informat specification) and having a date value less than 10 bytes long.&lt;BR /&gt;
&lt;BR /&gt;
I wonder if there might be some other kind of problem that it just showing up as a date problem.  I often use the DSD option on the INFILE statement (assuming that the CSV file fully conforms to standards, i.e., if a character field has an embedded comma, it is enclosed in double quotes).</description>
      <pubDate>Thu, 13 Aug 2009 13:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64145#M13970</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-13T13:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64146#M13971</link>
      <description>Well it isn't necessarily a date problem. I am just getting the invalid data error. &lt;BR /&gt;
&lt;BR /&gt;
Shoooooot. This is bugging me big time.</description>
      <pubDate>Thu, 13 Aug 2009 13:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64146#M13971</guid>
      <dc:creator>Aar684</dc:creator>
      <dc:date>2009-08-13T13:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64147#M13972</link>
      <description>You will need to share more about the SAS execution log, as well as suggesting you add some self-diagnostic code:&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
...AND/OR...&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG _INFILE_;&lt;BR /&gt;
&lt;BR /&gt;
...AND/OR...&lt;BR /&gt;
&lt;BR /&gt;
LIST;&lt;BR /&gt;
&lt;BR /&gt;
Using these statements in your SAS program for the DATA step will help you learn more about the current data record's and how SAS is interpreting them.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 13 Aug 2009 15:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64147#M13972</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-13T15:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64148#M13973</link>
      <description>By any chance are you looking at the CSV file in Excel and not a text editor? I have had occasions where saving a CSV from Excel results in dates converting from something 10/01/2008 to an Excel date offset integer value that usually would not be acceptable to the SAS informat.</description>
      <pubDate>Tue, 18 Aug 2009 22:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64148#M13973</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2009-08-18T22:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64149#M13974</link>
      <description>Also, when you look at the file in a text editor, are all variables always aligned in a one neat column?</description>
      <pubDate>Wed, 19 Aug 2009 03:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64149#M13974</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-08-19T03:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date informat problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64150#M13975</link>
      <description>Try this way, it worked for me:&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
&lt;BR /&gt;
infile 'K:\LOAD RESEARCH\CLP Rate Case Test Year 07-01-08 to 06-30-09\CSV Files Dist Run\w Legacy\input\1.csv' lrecl=350 missover dlm=',' ;&lt;BR /&gt;
&lt;BR /&gt;
input account :$11. meter :$11. legacy :$11. channel :$13. lrid :$16. name :$33. units date :MMDDYY10. yvar1-yvar24;&lt;BR /&gt;
&lt;BR /&gt;
format date mmddyy10.;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I didn't see the variable RATE in the input, so I left it out.  I couldn't get the date to format properly without the format statement.</description>
      <pubDate>Wed, 19 Aug 2009 19:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-informat-problem/m-p/64150#M13975</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2009-08-19T19:51:55Z</dc:date>
    </item>
  </channel>
</rss>

