BookmarkSubscribeRSS Feed
monona
Obsidian | Level 7

Hello,

 

I am wondering if there is any other way to export sas dataset to ms sql server other than sas_dataset>csv>ms sql dataset manually.

 

I connected to the MS sql server through 

libname ABC odbc noprompt = "server=SQLSVR;driver=SQL server native client 11.0; 
Trusted_connection=yes" database=mydatabase schema=dbo;

However, i haven't understood how this works.

 

I would appreciate any recommendations/tips regarding this problem.

2 REPLIES 2
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

A couple of suggestions:

Use SAS to load a temporary SQL Server table which is then used by the SQL Server load process.
Write a delimited file from SAS then get the SQL Server load process to read the delimited file

https://communities.sas.com/t5/SAS-Data-Management/Load-SAS-Dataset-to-MS-SQL-Server-via-SQL-server-...

 

us the update statement in you datastep or sql statement.

 

Patrick
Opal | Level 21

@monona 

What do you mean by "manually"? Once you've defined the library connecting to the data base you can use it like any other libref.

Code like below would append data from sashelp.class to a table class on your server. It even would create the table in the database if it doesn't exist already.

proc append base=abc.class data=sashelp.class;
run;

The SAS/Access to ODBC documentation will provide you with much more detail.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2041 views
  • 1 like
  • 3 in conversation