LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 8 Oct 2006 22:23:17 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Regarding date format validation

On Thu, 5 Oct 2006 13:08:35 -0700, vj <vijay_sas@HOTMAIL.COM> wrote:

>Hi All, >Please help me anybody how do I validate for a date format. >First of all I gave already this problem yesterday. Nat Wood told >me.Infact I didn't mention correct query. >Now I am coming from the scratch. > >I have a data set which has three variables. 1. Acctnum 2. Invdate 3. >Invduedate. >I want to remove Null values in Acctnum. And I want to write to file >Abend if Invdate,Invduedate don't have mm-dd-yy format. I mean Other >than mm-dd-yy format should be abend. > > >I am working in Mainframe(SAS). I have an existing data set created >already. >I want to adjust what ever we write the code in existing data step. >My existing data step can create number of output data sets , can >create several outputs using file and put statements. > >.I have data like this.. > >data x; >input Acctnum $5. Invdate $10. Invduedate$10.; >cards; >A123 1/2/2004 2/29/2004 >B124 2/13/2004 2/4/2004 > 4/4/2005 5/5/2005 > 5/5/2005 6/6/2005 >C125 7-7-05 8-4-05 >D126 8-04-05 9-05-05 >E 127 9-0-05 08-10-04 >; >RUN;

When I run this code I get

Obs Acctnum Invdate Invduedate 1 A123 1/2/2004 2 /29/2004 2 B124 2/13/2004 2/4/2004 3 4/4/2 005 5/5/20 4 5/5/2 005 6/6/20 5 C125 7-7-05 8-4-05 6 D126 8-04-05 9-05-05 7 E 127 9-0-05 08-10-04

I think you should debug your example.

However, I can see what the intent is.

It's not clear what you want to do about date validation. You should be more specific.

I would say that there are 3 kinds of date validation.

1. Gregorian calendar rules: The best way to check these is to use the INPUT function (with the "??" modifier) and the MMDDYY informat to convert the string values to SAS dates.

2. Business rules: These you must specify.

3. Pattern: It seems you require the pattern (pseudocode)

start digit*2 hyphen digit*2 hyphen digit*2 space*2 end

Perhaps you actually wish to relax this. For example, you may want to allow 4-digit years, or 1-digit days and months.

> > > >Please suggest me to finish this program.. > >Thank you very much >VJ...


Back to: Top of message | Previous page | Main SAS-L page