Date: Fri, 28 Jun 1996 11:53:22 -0600
Reply-To: Bill Brady <BRADY@EPI.OPHTH.WISC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Bill Brady <BRADY@EPI.OPHTH.WISC.EDU>
Subject: Dates:unknown days or months
I am reading in some dates and sometimes the month or day of the
month is unknown. In these cases, those positions are filled with
'99'. Hoewever, these values are not valid dates, so SAS treats them
as missing. I need to know if there is actually a date present, even
if the day or month is unknown. And ideally would recode missing
month and day to July 1st and missing day to 15.
I've tried reading in the date as a character string and recoding the
'99's to other valid values, but that hasn't worked.
An example is below.
Thanks,
Bill Brady
Dept of Ophthalmology and Visual Sciences
University of Wisconsin-Madison
brady@epi.ophth.wisc.edu
------------------------------------------
data a;
input d mmddyy8.;
format d mmddyy8.;
put d;
cards;
01/09/50
01/09/99
01/99/50
99/01/50
;
run;
Log:
119 data a;
120 input d mmddyy8.;
121 format d mmddyy8.;
122 put d;
123 cards;
01/09/50
01/09/99
NOTE: Invalid data for D in line 126 1-8.
.
RULE:----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
126 01/99/50
D=. _ERROR_=1 _N_=3
NOTE: Invalid data for D in line 127 1-8.
.
127 99/01/50
D=. _ERROR_=1 _N_=4
NOTE: The data set WORK.A has 4 observations and 1 variables.
NOTE: Compressing data set WORK.A decreased size by 0.00 percent.
Compressed is 1 pages; un-compressed would require 1 pages.
NOTE: DATA statement used the following computer resources:
Page faults: 359 CPU time: 0 00:00:00.10
128 ;
129 run;
----------------------------------------------------------------------------