BookmarkSubscribeRSS Feed
goms
Fluorite | Level 6

Hi,

I am new to SAS and I want to compare the below fields in the same table

Please let me know how to compare the two different datatype ?

 

Sr_date  mentioned as varchar_type

dt_date mentioned as date_type

 

Example

 

sr_date                                          dt_date

10/05/2014 14:01:18                     2014-10-05

 

Date values should be same in both fields .if anyting mismatched, query should pick the unmatched record

Please let me know how to write a query for the above scenario?

 

2 REPLIES 2
Kurt_Bremser
Super User
if dt_date = input(substr(sr_date,1,10),ddmmyy10.) then do .....

BTW, SAS only knows two data types, character and numeric.

'SAS dates' are numeric values containing the number of days since 01/01/1960 and having one of the date formats assigned.

There are no varchar variables in SAS, only fixed length character.

ballardw
Super User

Are you working with a SAS dataset or an external database? If the later you may have to specify which as there are some gotcha's depending.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2464 views
  • 0 likes
  • 3 in conversation