SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

data from SQL db to SAS

Reply
New Contributor
Posts: 2

data from SQL db to SAS

Hi can anybody help me to finish my thesis please? I need to import data from SQL server to SAS and I´m so bad at it Smiley Sad

thx for any help!

Super User
Posts: 6,938

Re: data from SQL db to SAS

The simplest method is to unload your SQL tables into files with a textual format (CSV or fixed column) and then use a proper data step to import the data into SAS.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Regular Contributor
Posts: 161

Re: data from SQL db to SAS

Another option....

 

1) connect to your SQL database within your SAS program using the loginid & password defined in a LIBNAME statement 

2) all the SQL tables can be read as SAS files and set using SET statements using the structure "libref.filename".   

 

Alternatively, instead of step 2), you can also use a proc sql to create a SAS file from "CREATE TABLE " syntax reading the SQL Table.

 

Either one should bring you the data. 

Kannan Deivasigamani
Respected Advisor
Posts: 3,892

Re: data from SQL db to SAS

What does your environment look like?

Are you able to connect to the SQL server via SAS at all - and have you done this before meaning is the environment already set-up?

 

If the environment is already set-up and there is a libname statement pointing to the SQL server then you can use tables in the database for reading as if they were SAS tables.

New Contributor
Posts: 2

Re: data from SQL db to SAS

thx for all response.

 

It can be that the problem is in connection between my SAS acount (at the school) and SQL db. I simplican not to connect to the server.

Respected Advisor
Posts: 3,892

Re: data from SQL db to SAS

Someone at your school will be looking after the SAS installation. Try to find this SAS Admin and get some support.

 

 

 

Ask a Question
Discussion stats
  • 5 replies
  • 340 views
  • 1 like
  • 4 in conversation