BookmarkSubscribeRSS Feed
imdickson
Quartz | Level 8

Hi SAS Community.

 

This is what i am facing currently. I am having difficulty to convert SAS Datetime to SQL Datetime.

The display value in SAS Datetime is 28Mar2018:10:01:06 which is actually "28Mar2018:10:01:96"dt when doing Proc SQL.

The display value is SQL Datetime is 2018-03-28 10:01:06.000 which is actually '2018-03-28 10:01:06.000' when using SQL Pass through.

 

I have the SAS datetime value and want to use it in SQL Pass through statement. I have been finding online but i couldnt find any related information. The most i could find is only converting Date.

 

The Passthrough statement should be something like this(without the connect to xxx statement)

 

%let sasdatetime=2018-03-28 10:01:06.000;

/*How to convert the value above to SQL format and apply in proc sql below*/


Proc sql:

connect to xxx
select *

from table A

where birthdatetime = &thedatetime;

 

 

Seeking for your kind advice.

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Like this?

where birthdatetime = %nrbquote('&sasdatetime') ;

 

 

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 958 views
  • 0 likes
  • 2 in conversation