| Date: | Fri, 29 Sep 2006 10:37:08 -0400 |
| Reply-To: | Scott Czepiel <sczepiel@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Scott Czepiel <sczepiel@GMAIL.COM> |
| Subject: | Re: Newbi does date checking badly |
| In-Reply-To: | <4B143AC8A58A0A42AC375A11B459CAE6030B62E5@GNBEX03.gnb.ca> |
| Content-Type: | text/plain; charset=ISO-8859-1; format=flowed |
Is there any way you can run this code and validate against a set of known
good output? If not, you could try it with a test dataset that contains
specific instances of death date and end date so you can test whether the
output conforms to your expectations.
One thing that looks fishy to me is the retain statement. Is there some
good reason for including this statement?
On 9/29/06, Beaulieu, Serge (DHW/SME) <Serge.Beaulieu@gnb.ca> wrote:
>
> Hi Folks,
>
>
>
>
>
> I am attempting to process some data and my data is being rejected by my
> system (which I didn't write) because of bad dates
>
> (&date_of_death_var <> &insurance_end_date_var)
>
>
>
> I have been using SAS for about 7 months now and this is what I wrote to
> format/check my dates ... does anybody see anything wrong with this?
>
>
>
>
>
> /*This series of calculations checks: end_date & deathdate, applies a
> rule */;
>
> data regstep4.Registry2003_04; set regstep4.Registry2003_04;
>
> retain datecheck1;
>
> datecheck1=end_date-death_date;
>
>
>
> if 1<=datecheck1<=60 or -60<=datecheck1<=-1
>
> then end_date=death_date;
>
> else end_date=end_date;
>
> /* in other words if the dif between end_date&death_date is between
> (+/-)1-60*/;
>
> /* then end_date becomes death_date
> */;
>
>
>
> if 1<=datecheck1<=60 or -60<=datecheck1<=-1
>
> then PDO=PDO-datecheck1;
>
> else PDO=PDO;
>
>
>
> /* ie if the dif between end_date&death_date is between (+/-)1-60* then
> */;
>
> /* adjust the PDO accordingly
> */;
>
> run;
>
>
>
> data regstep4.Registry2003_04 (drop=datecheck1 datecheck2);
>
> set regstep4.Registry2003_04;
>
> keep ID SEX BIRTH_DATE DEATH_DATE STARTDT END_DATE PDO YEAR REGION
> GEOLOCATION;
>
> run;
>
> /* This effectively drops the datecheck1,2 variables */;
>
>
>
>
>
> Thank in advance folks!
>
>
>
> Serge
>
>
>
>
>
>
>
|