BookmarkSubscribeRSS Feed
sobol007
Calcite | Level 5

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 😞

thx for any help!

5 REPLIES 5
Kurt_Bremser
Super User

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.

kannand
Lapis Lazuli | Level 10

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
Patrick
Opal | Level 21

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.

sobol007
Calcite | Level 5

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.

Patrick
Opal | Level 21

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

 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1094 views
  • 1 like
  • 4 in conversation