Validation of date values

Reply
Regular Contributor
Posts: 167

Validation of date values

Hi,

I need to do a date validation to check if the date value entered into a data set is greater than or equal to sysdate.

User would be opening the data set to enter the value. If he is enters  a date value less than sysdate, error should pop up.

I am planning to use IC create statements.

Is there any alternate way?

Thanks in advance,

Super User
Posts: 19,815

Re: Validation of date values

Hi Sheeba,

Is through SAS/AF?

Regular Contributor
Posts: 167

Re: Validation of date values

Hi Reeza,

Thanks for the reply .It is through SAS EG

Super Contributor
Posts: 644

Re: Validation of date values

In a program segment:

Data _NULL_ ;

     Set Dateinput ;

     If     User_Date < "&Sysdate"D then _ERROR_ ;

Run ;

This should create an error which you can trap within your process.

Richard

Regular Contributor
Posts: 167

Re: Validation of date values

Posted in reply to RichardinOz

Thanks Richard. will try that option.

Regular Contributor
Posts: 167

Re: Validation of date values

Hi Richard,

I am trying to create a template which is to be used by a set of users. They would be entering the date by opening the data set. I am trying to pop up an error message in case the date value entered is less than sysdate. I believe the above code holds good when the input is read from a particular data set. Do you see any alternate ways of enforcing this constraint.

Thanks in advance,

Super User
Posts: 19,815

Re: Validation of date values

I may be highly mistaken, but I don't think SAS EG is designed to input data in such a way.

SAS/AF is the way to create input information.

You can validate information after it's been entered, or if was selection in a drop down for a query, but to validate data as its entered sounds a little beyond its control.

Regular Contributor
Posts: 167

Re: Validation of date values

Thanks Reeza...

I am planning to use ic create statement with proc datasets for acheieving the same.

Super User
Posts: 19,815

Re: Validation of date values

How do you enable a user to be able to open the data set and edit in EG though? This is the part I don't understand. Do you have a customized task? Does the dataset get updated or is it overwritten?

Regular Contributor
Posts: 167

Re: Validation of date values

The data set is getting updated and not overwritten.

user would be opening the data set in EG and enter the value.

Super User
Posts: 19,815

Re: Validation of date values

Interesting, definitely not a use I've heard of before. I'd be curious to hear how it works out down the road.  

I guess my suggested work around would have been a input mechanism through Microsoft ACCESS, where a copy of the tables are accessed via ACCESS and then used to update the source tables. Rules can be implemented in Access rather than SAS.  You can do a similar process through EG.

Regular Contributor
Posts: 167

Re: Validation of date values

Thanks a lot Reeza...I Will definitely try out

Ask a Question
Discussion stats
  • 11 replies
  • 1033 views
  • 0 likes
  • 3 in conversation