BookmarkSubscribeRSS Feed
ammarhm
Lapis Lazuli | Level 10

Hi everyone,

i would really appreciate your help in solving an issue connecting to SQL database. Basically I am trying to copy the table 'Lab' which is stored in a SQL server 'Hospital' under database 'Results'.

The SQL server is hosted on a network connected machine. I have trusted connection to the SQL server, s basically if I login into windows with my credentials and start Microsoft SQL management studio then i can directly connect to the SQL server 'Hospital' and view the database 'Results' with its tables including Lab.  

I want to copy the table 'Lab' into SAS for processing. 

I tried usin the following code:

 

Libname SQL_Lib ODBC NoPrompt="Driver=SQL Server;Server=Hospital; Database=Results;  schema = dbo; Trusted_Connection=Yes"; 

This does not generate an error, however when i double click on the new library in SAS explorer window, there are no contents inside the library and I do not know if there is anything wrong with my code or if i should be using a code (which?) to copy the table without worrying about the absence of contents in the library.

Any help is much appreciated. 

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Try that.

proc copy in=SQL_LIB out=WORK; select LAB; run;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 599 views
  • 0 likes
  • 2 in conversation