| Date: | Fri, 2 May 1997 03:16:27 GMT |
| Reply-To: | 102146.2003@compuserve.com |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | "K. Beckman" <102146.2003@COMPUSERVE.COM> |
| Organization: | CompuServe Incorporated |
| Subject: | Re: text data in mm/dd/yy hh:mm:ss format |
| Content-Type: | text/plain; charset=us-ascii |
Dear Frank:
On Tue, 29 Apr 1997 11:06:58 -0400, Frank Schiffel
<MOPRO.FSCHIFFE@SDPS.ORG> wrote:
>>
>>I received text data in 'mm/dd/yy hh:mm:ss' format. the blanks between
>>the quotes are there in the data. Is this a readable format using SAS
>>Informats? I'm using SAS 6.11 on Windows 3.1 on a Dell PC.
>>
>>As patient encounter date is a key analysis variable (this whole ball of
>>wax has to be collapsed down to a single line per patient entry date) if
>>this isn't a readable format, I'll have to ask for it again from the
customer.
>>
>>I've found a time date format of dd/mm/yy hh:mm:ss in the informats.
>>haven't seen this one.
>>
>>tia.
>>
>>Frank Schiffel
>>Health Data Analyst
>>Missouri Patient Care Review Foundation
The following snippet of 6.09 MVS code uses the SAS dhms, hour,
minute, and second functions to yield a SAS datetime variable
(assuming that is what you want) from the SAS date and time variables
in the input data. The dates straddle the year 2000 to illustrate the
use of the yearcutoff option. Sorry about leaving out the raw data.
388 options yearcutoff=1950 ;
389
389 data work.readit ;
390 attrib
391 dtvar length=8 format=datetime20.
392 date length=5 format=date9.
393 time length=8 format=time8.
394 ;
395 infile datalines ;
396 input date mmddyy8. +1 time time8. ;
397 dtvar = dhms(date,hour(time),minute(time),second(time)) ;
398 put _all_ ;
399 datalines ;
DTVAR=01APR1950:00:00:00 DATE=01APR1950 TIME=0:00:00 _ERROR_=0 _N_=1
DTVAR=01MAY1997:23:59:59 DATE=01MAY1997 TIME=23:59:59 _ERROR_=0 _N_=2
DTVAR=04AUG2000:14:00:00 DATE=04AUG2000 TIME=14:00:00 _ERROR_=0 _N_=3
DTVAR=05SEP2001:22:00:00 DATE=05SEP2001 TIME=22:00:00 _ERROR_=0 _N_=4
DTVAR=06NOV2049:00:00:00 DATE=06NOV2049 TIME=0:00:00 _ERROR_=0 _N_=5
NOTE: The data set WORK.READIT has 5 observations and 3 variables.
NOTE: The DATA statement used the following resources:
CPU time - 00:00:00.02
Elapsed time - 00:00:00.03
Vector affinity time - 00:00:00.00
Vector usage time - 00:00:00.00
RSM Hiperspace time - 00:00:00.00
EXCP count - 4
Task memory - 83K (40K data, 43K program)
Total memory - 4102K (3260K data, 842K program)
405 ;;
406 run ;
I hope this is of some assistance.
Sincerely
Kurt D. Beckman
SAS Consultant
553 N. Pacific Coast Hwy, Suite B288
Redondo Beach, California 90277
Voice: 310-318-5291
Fax: 310-318-6220
Cellular: 310-486-4447
E-Mail: 102146.2003@compuserve.com
[Posted with Agent .99g. For info, email agent-info@forteinc.com.]
|