SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

write the SAS results into a SQL Server table

Reply
Contributor
Posts: 38

write the SAS results into a SQL Server table

Hi,

I would like to know if anyone knows how to export data from SAS to SQL Server?

Thank you.

Trusted Advisor
Posts: 1,028

Re: write the SAS results into a SQL Server table

If it is a small quantity of records (<10,000):

1. Define your SQL Server database and schema as a SAS library, using SAS/Access (I assume you've already done this).

2. Use either data step or proc sql:

libname sqllib ...;

/* data step */

data sqllib.newdata;

set work.olddata;

run;

/* proc sql */

proc sql;

create table sqllib.newdata as

select * from work.olddata;

quit;

I don't have access to SAS in my environment, so there may be some syntax errors. But is should be close. Of course, SAS being SAS, there are many other ways to do it.

The 10,000 record limit is somewhat arbitrary, based on my experience. If the above option is too slow, there is an option to use the SQL Server bulk loader. I've never used in in SQL server, but in another environment the bulk loader was 100 to 1000 times faster.

Tom

Contributor
Posts: 38

Re: write the SAS results into a SQL Server table

Thank you so much.

Post a Question
Discussion Stats
  • 2 replies
  • 2176 views
  • 0 likes
  • 2 in conversation