<?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 Issue with dates using import wizard code in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Issue-with-dates-using-import-wizard-code/m-p/215354#M52999</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4, and have a csv file that I was successfully able to import using the import wizard. However, when I attempt to execute the import using the code generated in the log, I am getting invalid data errors for several of the date fields. These were formatted as mmddyy10., which matches format of date fields in my file (ie. 3/24/2008). How is it that the same code that was generated from the wizard does not work when run in a program? I tried it again using date9. but am getting the same errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;From an automation perspecitve, I'd much rather have use the code than having to run the wizard every time. &lt;/SPAN&gt;Any assistance on this is much appreciated, as I've tried to solve this with no luck. Let me know if there's any additional info that would be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 May 2015 02:30:33 GMT</pubDate>
    <dc:creator>FC_Chris</dc:creator>
    <dc:date>2015-05-15T02:30:33Z</dc:date>
    <item>
      <title>Issue with dates using import wizard code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Issue-with-dates-using-import-wizard-code/m-p/215354#M52999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4, and have a csv file that I was successfully able to import using the import wizard. However, when I attempt to execute the import using the code generated in the log, I am getting invalid data errors for several of the date fields. These were formatted as mmddyy10., which matches format of date fields in my file (ie. 3/24/2008). How is it that the same code that was generated from the wizard does not work when run in a program? I tried it again using date9. but am getting the same errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;From an automation perspecitve, I'd much rather have use the code than having to run the wizard every time. &lt;/SPAN&gt;Any assistance on this is much appreciated, as I've tried to solve this with no luck. Let me know if there's any additional info that would be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2015 02:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Issue-with-dates-using-import-wizard-code/m-p/215354#M52999</guid>
      <dc:creator>FC_Chris</dc:creator>
      <dc:date>2015-05-15T02:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with dates using import wizard code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Issue-with-dates-using-import-wizard-code/m-p/215355#M53000</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;&amp;nbsp; Consider this comma separated data that represents some basic family information about 2 people:&lt;BR /&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;Joseph,23feb1934,06/15/1953,31may1957,8/31/1961,Mary&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;Dorothy,01mar1935,06/15/1954,1958/05/29,28/6/1960,Nicholas&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And, note how the first date is in the form ddmonyyyy, and the second date is in mmddyy form; but the 3rd and 4th dates are displayed differently. Let's say I have this data in a file called&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt; c:\temp\gen_data.csv&lt;/STRONG&gt;&lt;/SPAN&gt;, then the program to read this data and control how to read the dates would be as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that my program reads the BDAY variable using the DATE. informat; then GRAD_HS is read using the MMDDYY. informat; but the GRAD_COLLEGE and the MARRY variables are read with the ANYDTDTE informat because each record uses a different way to represent the date and so, if I want to give SAS the best chance of reading the date value, I need to use a more flexible informat. But, no matter what INFORMAT I use to READ the data from the CSV file into a SAS dataset, I can use a pre-defined SAS format for display purposes. Report #1 shows ALL the dates formatted with MMDDYY10. format and Reprot #@ shows using the WORDDATE. format -- no matter how I needed to read them, I can display them anyway I want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data readdate;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; infile 'c:\temp\gen_data.csv' dlm=',' dsd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; input name $ bday : date. grad_HS : mmddyy. grad_college : anydtdte. marry : anydtdte. spouse $;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; format bday grad_HS grad_college marry mmddyy10.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc print data=readdate;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title '1) Note how ANYDTDTE reads ANY date form as input';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title2 'But date. and mmddyy. can ONLY read dates in one specific form';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title3 'Then the date can be displayed any way you want';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc print data=readdate;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title '2) dates formatted with worddate.';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;format bday grad_HS grad_college marry worddate.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;Produces this output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&lt;IMG alt="results_date_format.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/10433_results_date_format.png" width="450" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2015 16:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Issue-with-dates-using-import-wizard-code/m-p/215355#M53000</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-05-15T16:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with dates using import wizard code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Issue-with-dates-using-import-wizard-code/m-p/215356#M53001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a close look at those errors if they are only occurring for some records. You should get a dump of the current input line and the values of variables read. Examine that input line for INVALID dates such as 30 Feburary, 2/30/yyyy, or 29 Feb in a non-leapyear or 31 days in any month that only has 30. Or perchance extreme values for a year such as 20013.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may also have some data sent to you as dd/mm/yyyy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Post some of the log showing the error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2015 18:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Issue-with-dates-using-import-wizard-code/m-p/215356#M53001</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-05-15T18:18:01Z</dc:date>
    </item>
  </channel>
</rss>

