DATA Step, Macro, Functions and more

Isdate

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

Isdate

Good morning,

Im looking to see if sas can accomodate something similar to ISdate() function similar to sql,

 

i tried it in sas but its returning the function is not available.

 

my goal is to filter through 6million records to count any instance of non date and time in a field.


Accepted Solutions
Solution
‎06-15-2017 09:23 AM
Super User
Posts: 9,671

Re: Isdate

Unlike DataBase ,SAS don't have DATE type variable .

As long as integer take on date format , this variable is becoming a 'DATE' variable.

You can use function FMTINFO() to check if its format is a date or not .

Learn it from  @Tom yesterday .

View solution in original post


All Replies
Frequent Contributor
Posts: 103

Re: Isdate

Not directly ASFAIK but...

in PROC SQL you can use SAS functions and among them, regular expression functions.

You could therefore check if a given field conforms to your date/datetime requirements before retrieving the records.

You could also preprocess your dataset in order to determine the fields you are interested in.

These are 2 possibilities among others.

________________________

- That still only counts as one -

Super User
Super User
Posts: 7,392

Re: Isdate

count(case when input(date,date9.) > . then 1 else 0 end) as NUM_DATES

The input function will return a date or . depending on the data, so you can do the above.

 

 

Solution
‎06-15-2017 09:23 AM
Super User
Posts: 9,671

Re: Isdate

Unlike DataBase ,SAS don't have DATE type variable .

As long as integer take on date format , this variable is becoming a 'DATE' variable.

You can use function FMTINFO() to check if its format is a date or not .

Learn it from  @Tom yesterday .

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 158 views
  • 0 likes
  • 4 in conversation