<?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 Import Assistance in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24707#M4217</link>
    <description>No need to post in multiple forums - also this is the correct forum, given the topic area.  However, I replied in the other forum - see link:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?threadID=11697&amp;amp;tstart=0" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?threadID=11697&amp;amp;tstart=0&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Thu, 28 Oct 2010 17:50:40 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-10-28T17:50:40Z</dc:date>
    <item>
      <title>Date Import Assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24706#M4216</link>
      <description>I have data with date of births that I am trying to import.  Below is the code to import the date:&lt;BR /&gt;
&lt;BR /&gt;
DATA BIRTHNEW;&lt;BR /&gt;
  INFILE B4 END=EOF7 LRECL=1000;&lt;BR /&gt;
  IF EOF7 THEN INFILE B5 END=EOF8 LRECL=1000;&lt;BR /&gt;
  IF EOF8 THEN INFILE B6 END=EOF9 LRECL=1000;&lt;BR /&gt;
  IF EOF9 THEN INFILE B7 END=EOF10 LRECL=1000;&lt;BR /&gt;
  IF EOF10 THEN INFILE B8 END=EOF11 LRECL=1000;&lt;BR /&gt;
  IF EOF11 THEN INFILE B9 END=EOF12 LRECL=1000; &lt;BR /&gt;
&lt;BR /&gt;
INPUT CHILDDOB 55-62 HOSPITAL 73-76 MOMDOB 124-131;&lt;BR /&gt;
&lt;BR /&gt;
This obviously imports it as a numeric variable, but I have tried:&lt;BR /&gt;
&lt;BR /&gt;
INPUT CHILDDOB 55-62 Date8. HOSPITAL 73-76 MOMDOB 124-131 Date8.;&lt;BR /&gt;
&lt;BR /&gt;
But they do not import into my dataset correctly.  I have also tried just leaving the import as just a numeric variable and then changing the format from the ViewTable screen by double-clicking on the variable name and changing the Column Attributes, but I come across the problem that there are not leading zeros in my source data (Ex. 6032004, 2072005, 11072007) so all of the dates are not of the same length.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help!</description>
      <pubDate>Thu, 28 Oct 2010 17:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24706#M4216</guid>
      <dc:creator>MichaelM</dc:creator>
      <dc:date>2010-10-28T17:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Date Import Assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24707#M4217</link>
      <description>No need to post in multiple forums - also this is the correct forum, given the topic area.  However, I replied in the other forum - see link:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?threadID=11697&amp;amp;tstart=0" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?threadID=11697&amp;amp;tstart=0&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 28 Oct 2010 17:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24707#M4217</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-28T17:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date Import Assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24708#M4218</link>
      <description>Hi:&lt;BR /&gt;
  As it explains here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001052066.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001052066.htm&lt;/A&gt;&lt;BR /&gt;
  when it says about column input (of the form 1-10, etc):&lt;BR /&gt;
"You can read standard character and numeric data only. Informats are ignored."&lt;BR /&gt;
&lt;BR /&gt;
So, although you are correct that you need an INFORMAT to read the dates, you will have to change your INPUT statement in order to have the date variables read correctly. It should be a big deal. The program below doesn't have your exact layout, but shows the form of input statement you should try. This form of INPUT is called "formatted input" and you can read an introduction about it here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001052077.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001052077.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
DATA BIRTHNEW;&lt;BR /&gt;
INFILE datalines;&lt;BR /&gt;
input @1 name $4.&lt;BR /&gt;
      @6 childdob mmddyy8. &lt;BR /&gt;
      @15 hospital 3.&lt;BR /&gt;
      @19 momdob  mmddyy8.;&lt;BR /&gt;
                  &lt;BR /&gt;
putlog 'Show Internal Values in Log';&lt;BR /&gt;
put _all_;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
alan  6032004 111 11151963&lt;BR /&gt;
bob  12242005 111  6181967&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                             &lt;BR /&gt;
proc print data=birthnew;&lt;BR /&gt;
  title 'Show different formats for mom and child dob';&lt;BR /&gt;
  format childdob mmddyy10. momdob date9.;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 28 Oct 2010 17:51:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24708#M4218</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-28T17:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date Import Assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24709#M4219</link>
      <description>Thanks Scott,&lt;BR /&gt;
I have successfully coded for separate M D and Y variables below:&lt;BR /&gt;
&lt;BR /&gt;
INPUT MBC 55-56 DBC 57-58 YBC59-62 DOB_B 55-62;&lt;BR /&gt;
&lt;BR /&gt;
Now that I have them separated, do I then:&lt;BR /&gt;
&lt;BR /&gt;
Format ChildDOB = MDY (MBC, DBC, YBC);</description>
      <pubDate>Thu, 28 Oct 2010 18:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24709#M4219</guid>
      <dc:creator>MichaelM</dc:creator>
      <dc:date>2010-10-28T18:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date Import Assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24710#M4220</link>
      <description>Hi:&lt;BR /&gt;
  If you want to take this approach (using the MDY function) then the syntax would be:&lt;BR /&gt;
[pre]&lt;BR /&gt;
childdob = mdy(mbc, dbc, ybc);&lt;BR /&gt;
format childdob mmddyy10.;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
            &lt;BR /&gt;
The assignment  statement converts your 3 separate variables into one SAS date variable, which represents the number of days since Jan 1, 1960. Then the FORMAT statement would instruct SAS what format to use for the display of the date variable.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 28 Oct 2010 18:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24710#M4220</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-28T18:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date Import Assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24711#M4221</link>
      <description>Thank you, Cynthia and Scott!  It worked!  Sorry for the duplicate post.</description>
      <pubDate>Thu, 28 Oct 2010 18:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24711#M4221</guid>
      <dc:creator>MichaelM</dc:creator>
      <dc:date>2010-10-28T18:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date Import Assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24712#M4222</link>
      <description>To the OP:&lt;BR /&gt;
&lt;BR /&gt;
For future reference, suggest using Google to find SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website DOC and supplemental technical / conference papers which can help you with syntax issues as you learn the SAS language.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
mdy function site:sas.com</description>
      <pubDate>Thu, 28 Oct 2010 19:08:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Import-Assistance/m-p/24712#M4222</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-28T19:08:19Z</dc:date>
    </item>
  </channel>
</rss>

