reading date values

reading date values

Post by Sa » Sun, 30 Mar 2003 00:51:23



Thanks for ur previous answers.

The date value is stored in char format.
08mar2003  $9.

i want date part as 08mar03

The time is in the form 1790 $4.
i want to read it as 17:90
Please let me know.

thank you

 
 
 

reading date values

Post by Chakravarthy, Ven » Sun, 30 Mar 2003 01:49:03


First, read them in as date and time values that SAS can use. Then you have
the flexibility to display them in whatever manner you want. To convert
these character values into numeric SAS date and time fields use the
following:

CAVEAT: Assuming that the character date and time fields are robust and
accommodate leading zeroes where needed.

data _null_ ;
   chardate = "08mar2003" ;
   chartime = "1740" ;
   numdate = input(chardate,date9.) ;
   numtime = input(substr(chartime,1,2)||":"||substr(chartime,3,2),time.) ;
   format numdate date7. numtime time5. ;
   put numdate=  numtime= ;
run ;

NUMDATE=08MAR03 NUMTIME=17:40

Kind Regards,
__________________________
Venky Chakravarthy

-----Original Message-----

Sent: Friday, March 28, 2003 10:51 AM

Subject: reading date values

Thanks for ur previous answers.

The date value is stored in char format.
08mar2003  $9.

i want date part as 08mar03

The time is in the form 1790 $4.
i want to read it as 17:90
Please let me know.

thank you

LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.