SAS Date question

SAS Date question

Post by ceasa » Sat, 02 Sep 2000 05:30:51



I have the following date format that seems to be throwing some  my
other variables off:

6/30/94 0:00:00

When I manually delete this date variable from the input file, then run
the following program, everything is fine.  But, I have 300 of these
types of files, and I don't want to manually do this.  I tried skipping
the first variable (by putting +5 CERT), reading REPDTE as a Character
string, and this hasn't helped.  Any suggestions?  REPDTE is the
variable with this wierd date format.

libname DEP 'f:\deposits\';
data DEP.AR;
infile 'f:\deposits\1994\Ar_1994.csv' FIRSTOBS=2 delimiter=',' MISSOVER
DSD PAD;

     /*   informat REPDTE mmddyy10. ;  */
         informat CERT best12. ;
         informat DOCKET best12. ;
         informat NAMEFUL $80. ;
         informat ADDRESB $80. ;
         informat CITY2BR $70. ;
         informat CITYBR $70. ;
         informat STNAMEB $70. ;
         informat ZIPBR $10. ;
         informat CNTYNAM $40. ;
         informat MSANAMB $70. ;
         informat CMSANAM $70. ;
         informat DEPSUMB best12. ;
         informat BKCLASS $5. ;
         informat CITY2M $70. ;
         informat CITY $70. ;
         informat STNAME $70. ;
         informat BRCENM $5. ;

    /*   format REPDTE mmddyy10. ;  */
         format CERT best12. ;
         format DOCKET best12. ;
         format NAMEFUL $80. ;
         format ADDRESB $80. ;
         format CITY2BR $70. ;
         format CITYBR $70. ;
         format STNAMEB $70. ;
         format ZIPBR $10. ;
         format CNTYNAM $40. ;
         format MSANAMB $70. ;
         format CMSANAM $70. ;
         format DEPSUMB best12. ;
         format BKCLASS $5. ;
         format CITY2M $70. ;
         format CITY $70. ;
         format STNAME $70. ;
         format BRCENM $5. ;

input        /*     REPDTE  */
                  CERT
                  DOCKET
                  NAMEFUL $
                  ADDRESB $
                  CITY2BR $
                  CITYBR $
                  STNAMEB $
                  ZIPBR $
                  CNTYNAM $
                  MSANAMB $
                  CMSANAM $
                  DEPSUMB
                  BKCLASS $
                  CITY2M $
                  CITY $
                  STNAME $
                  BRCENM $;

run;

 
 
 

SAS Date question

Post by Paul Dorfm » Sat, 02 Sep 2000 06:51:05


Ceasar,

If you need date only, you should only read 8 bytes from the field. When you
read 10, you are trying to make SAS interpret a literal like
"6/30/94 0:" as a SAS date, which cannot be interpreted as valid. The
informat MMDDYY8. should work. If you also need time, input another variable
8 bytes later using the TIME. informat, or, alternatively, input the entire
string, scan it into two tokens using a blank as a delimiter, and input the
chunks using MMDDYY8. and TIME. separately.

Kind regards,
====================
Paul M. Dorfman
Jacksonville, Fl
====================




>Subject: SAS Date question
>Date: Thu, 31 Aug 2000 20:30:51 GMT

>I have the following date format that seems to be throwing some  my
>other variables off:

>6/30/94 0:00:00

>When I manually delete this date variable from the input file, then run
>the following program, everything is fine.  But, I have 300 of these
>types of files, and I don't want to manually do this.  I tried skipping
>the first variable (by putting +5 CERT), reading REPDTE as a Character
>string, and this hasn't helped.  Any suggestions?  REPDTE is the
>variable with this wierd date format.

>libname DEP 'f:\deposits\';
>data DEP.AR;
>infile 'f:\deposits\1994\Ar_1994.csv' FIRSTOBS=2 delimiter=',' MISSOVER
>DSD PAD;

>      /*   informat REPDTE mmddyy10. ;  */
>          informat CERT best12. ;
>          informat DOCKET best12. ;
>          informat NAMEFUL $80. ;
>          informat ADDRESB $80. ;
>          informat CITY2BR $70. ;
>          informat CITYBR $70. ;
>          informat STNAMEB $70. ;
>          informat ZIPBR $10. ;
>          informat CNTYNAM $40. ;
>          informat MSANAMB $70. ;
>          informat CMSANAM $70. ;
>          informat DEPSUMB best12. ;
>          informat BKCLASS $5. ;
>          informat CITY2M $70. ;
>          informat CITY $70. ;
>          informat STNAME $70. ;
>          informat BRCENM $5. ;

>     /*   format REPDTE mmddyy10. ;  */
>          format CERT best12. ;
>          format DOCKET best12. ;
>          format NAMEFUL $80. ;
>          format ADDRESB $80. ;
>          format CITY2BR $70. ;
>          format CITYBR $70. ;
>          format STNAMEB $70. ;
>          format ZIPBR $10. ;
>          format CNTYNAM $40. ;
>          format MSANAMB $70. ;
>          format CMSANAM $70. ;
>          format DEPSUMB best12. ;
>          format BKCLASS $5. ;
>          format CITY2M $70. ;
>          format CITY $70. ;
>          format STNAME $70. ;
>          format BRCENM $5. ;

>input        /*     REPDTE  */
>                   CERT
>                   DOCKET
>                   NAMEFUL $
>                   ADDRESB $
>                   CITY2BR $
>                   CITYBR $
>                   STNAMEB $
>                   ZIPBR $
>                   CNTYNAM $
>                   MSANAMB $
>                   CMSANAM $
>                   DEPSUMB
>                   BKCLASS $
>                   CITY2M $
>                   CITY $
>                   STNAME $
>                   BRCENM $;

>run;

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

 
 
 

1. SAS Date Question?

   We currently use YYYYMM, 200007 for July 2000 as standard.  Should I
convert that date standard to SAS date if I want to use it in SAS?
Is there any benefit for using SAS Date over the above date standard?  Do I
need to convert to SAS date if I need to do analysis or the above date would
be OK?

Regards,

Brian Vuong

2. File system for 8051

3. Converting SAS date to Java Date using JDBC and SAS/Share

4. BOCA MV34AI modem and Win95

5. Translating SAS dates into HUMAN dates

6. Verbatim sections of a file...

7. Antwort: Re: SAS dates in macro var/dates as array bounds

8. Best Telnet

9. SAS dates in macro var/dates as array bounds

10. SAS code to convert GMT date/time to local date/time

11. My question re date sensitive table lookup using sas

12. SAS/Base: MS Access link to SAS via SAS/ODBC - pulling SAS co lumn labels

13. SAS/Base: MS Access link to SAS via SAS/ODBC - pulling SAS column labels