<?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: A Date Error when reading into SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432234#M107030</link>
    <description>&lt;P&gt;Thank you very much for your fast response. I tried to add this colon before date informat, but it even gave me more errors.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jan 2018 15:04:09 GMT</pubDate>
    <dc:creator>monicazhou2013</dc:creator>
    <dc:date>2018-01-30T15:04:09Z</dc:date>
    <item>
      <title>A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432224#M107021</link>
      <description>&lt;P&gt;I have a program like this, every time I run it, it encountered several errors says,"NOTE: Invalid data for RatingDate in line 145(or other lines) 1-10." I am wondering where this program is wrong? Thank you in advance very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA CTL2015;&lt;BR /&gt;INFILE CARDS DLM='09'X;&lt;BR /&gt;INPUT Name :$24. Gender $ City :$10. State $ Rating $ RatingDate MMDDYY10. RatingType $;&lt;BR /&gt;CARDS;&lt;BR /&gt;Anderson, Stephen R. M Blythewood SC 4.0 12/31/2015 C&lt;BR /&gt;Bidwell, Stephen E. M Columbia SC 4.5 12/31/2015 C&lt;BR /&gt;Camps, Juan M Columbia SC 4.0 12/31/2015 C&lt;BR /&gt;Feuerstein, Eric M Blythewood SC 4.0 12/31/2015 C&lt;BR /&gt;Hitchcock, David M Columbia SC 4.0 12/31/2015 C&lt;BR /&gt;Houston, James Philip M Elgin SC 4.0 12/31/2015 C&lt;BR /&gt;Imholz, Mark M Blythewood SC 4.0 12/31/2015 C&lt;BR /&gt;Junis, Steven M Columbia SC 4.0 12/31/2015 C&lt;BR /&gt;Kuhn, Stanley M Blythewood SC 4.0 12/31/2015 C&lt;BR /&gt;Mantai, Michael M Lexington SC 4.0 12/31/2015 C&lt;BR /&gt;May, John M Columbia SC 4.5 12/31/2015 C&lt;BR /&gt;Mobley, John T. M Columbia SC 4.0 12/31/2015 C&lt;BR /&gt;Nguyen, Khue D. M Columbia SC 4.0 12/31/2015 C&lt;BR /&gt;Tanner, Mike D M Blythewood SC 4.0 12/31/2015 C&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 14:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432224#M107021</guid>
      <dc:creator>monicazhou2013</dc:creator>
      <dc:date>2018-01-30T14:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432228#M107025</link>
      <description>&lt;P&gt;You forgot a colon before the date informat.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 14:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432228#M107025</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-30T14:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432234#M107030</link>
      <description>&lt;P&gt;Thank you very much for your fast response. I tried to add this colon before date informat, but it even gave me more errors.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432234#M107030</guid>
      <dc:creator>monicazhou2013</dc:creator>
      <dc:date>2018-01-30T15:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432249#M107042</link>
      <description>&lt;P&gt;Most likely, the problem is&amp;nbsp;with the data not the program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For those lines where SAS complains, what does the line of data look like?&amp;nbsp; The date coming in probably does not look like a month/day/year date.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432249#M107042</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-30T15:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432256#M107045</link>
      <description>&lt;P&gt;Looks like perhaps your tabs got converted to spaces when you pasted the lines into the editor?&lt;/P&gt;
&lt;P&gt;It looks like you have spaces in your first field.&lt;/P&gt;
&lt;PRE&gt;Anderson, Stephen R. M Blythewood SC 4.0 12/31/2015 C
Bidwell, Stephen E. M Columbia SC 4.5 12/31/2015 C&lt;/PRE&gt;
&lt;P&gt;How do you know where the name ends and the gender code begins?&lt;/P&gt;
&lt;P&gt;You might be able to try counting the words from the end of the line, then what happens if you have a city name like North Little Rock?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your best solution is to use something other than space as the delimiter.&amp;nbsp; And if the delimiter appears in the value for a field then add quotes around that field.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA CTL2015;
  INFILE CARDS DSD DLM='|' truncover;
  length Name $24 Gender $1 City $10 State $2 Rating 8 RatingDate 8 RatingType $1 ;
  informat RatingDate MMDDYY. ;
  format RatingDate yymmdd10. ;
  input name -- ratingtype;
CARDS;
Anderson, Stephen R.|M|Blythewood|SC|4.0|12/31/2015|C
Bidwell, Stephen E.|M|Columbia|SC|4.5|12/31/2015|C
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432256#M107045</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-30T15:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432351#M107081</link>
      <description>&lt;P&gt;Thank you very much for your&amp;nbsp;great and fast help! I tried your method and it works well!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 17:26:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432351#M107081</guid>
      <dc:creator>monicazhou2013</dc:creator>
      <dc:date>2018-01-30T17:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432379#M107090</link>
      <description>&lt;P&gt;I have another question for you, if I have a million observations, it is impossible for me to do this manually. Do you have any other way to solve this problem? Thank you very much!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 17:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432379#M107090</guid>
      <dc:creator>monicazhou2013</dc:creator>
      <dc:date>2018-01-30T17:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432433#M107110</link>
      <description>&lt;P&gt;Yes and no.&amp;nbsp; If the original file still has the tabs then you can just DLM='09'X like you had before, but point to the original file and don't try to copy the file contents to your program.&amp;nbsp; That should avoid causing the tabs to turn into spaces.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile 'my_original_file.txt' dsd dlm='09'x truncover ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the original file has spaces between the fields that it will take a lot of work to figure out whether each line has spaces in the person's name or the city name and if so where to place delimiters between the fields.&lt;/P&gt;
&lt;P&gt;You might be able to make it more manageable by handling the obvious cases automatically and spitting the other case to another file to process by hand.&amp;nbsp; So your file had 7 fields. The examples you posted had three values for the first field. So each line should have 9 words and the fourth word should be M or F.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   infile 'my_original_file.txt' truncover ;
   length w1-w10 $100 ;
   input w1-w10 ;
   if countw(_infile_,' ','q') = 9 and w4 in ('M','F') then do;
    file 'pipe_delimited.txt' dsd dlm='|' ;
    w10=catx(' ',w1,w2,w3);
    put w10 w4-w9;
   end;
   else do;
     file 'problem_records.txt' ;
     put _infile_;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 18:56:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/432433#M107110</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-30T18:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: A Date Error when reading into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/433114#M107354</link>
      <description>&lt;P&gt;Thank you for your detailed answer, Tom! I think the problem is from copy and paste. We do not have the original file, we can only copy it from the website.I learned a lot form your explanation, thank you again for helping me about this!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 14:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Date-Error-when-reading-into-SAS/m-p/433114#M107354</guid>
      <dc:creator>monicazhou2013</dc:creator>
      <dc:date>2018-02-01T14:30:27Z</dc:date>
    </item>
  </channel>
</rss>

