BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can I insert data from a sas dataset into a sql table using passthrough? I have a sas dataset called inputdataset. I am using the following code to insert that into the database but the sas dataset is not recognized.

Proc SQL noprint;
Connect to odbc as FTP(required = "Dsn=&DbDsn");
Execute (Insert into ITGCostCurves
Select *, &PeriodDate as TimePeriod from InputDataSet) by FTP;
disconnect from FTP;
quit;
2 REPLIES 2
deleted_user
Not applicable
Hello pkr,

I'm afraid this won't be possible. With SQL pass through, the sql is executed directly by the database management system (The SQL must follow the syntax in use at dbms level). The dbms has no view on your SAS datasets.

If you want to insert data in a table, the best solution is to connect to the ODBC database using a libname statement. This should look like this:
libname dta ODBC dsn="&DbDsn";

The insert would look like this:
insert into dta.ITGCostCurves .... select ...

The "select" would be in SAS syntax.

Hope this helps,

Yoba Message was edited by: yoba

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
  • 912 views
  • 0 likes
  • 1 in conversation