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.
Try that.
proc copy in=SQL_LIB out=WORK; select LAB; run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.