BookmarkSubscribeRSS Feed
clcl
Calcite | Level 5

Is there any way to export  sas SQL to tSQL ?

Thanks

2 REPLIES 2
SASKiwi
PROC Star

SAS SQL is constructed between a PROC SQL statement and a closing semicolon, possibly followed by a QUIT statement.

proc sql;

create table table1 as

select *

from ............;

quit;

If you simply copy the bolded SQL into your tSQL editor it will in some cases work unmodified. You may have to tweak it to get it to work but for simple queries that shouldn't be a lot of work.

If you wish to do this a lot and repeatedly then you should use SAS's SQL Pass-through. In that case the SQL being used would be identical to tSQL.

LinusH
Tourmaline | Level 20

As you might have guesse from :s answer, the direct answer for your question is no, not any SAS Institute supported one at least.

Since SAS SQL programs are plain text files, there is nothing stopping anyone to write some kind of parser program to re-program to t-SQL - but I never heard of any such tool. In fact, this is what SAS/ACCESS to OLEDB/ODBC does behind the curtain - reprogram to native DBMS engine SQL. But I don't think that you can fetch this code on the fly, at least not from SAS.

But, why do you ask, what is your underlying requirement?

Data never sleeps

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 1026 views
  • 0 likes
  • 3 in conversation