I used the following code below to import data from an access database, but received several error messages. Is there an issue with how the code is written, or was the database moved?
libname sql access "\\hosted\dph\IS\AppDev\acdcfiles\SAHR Data Queries.accdb";
data deltbl; set sql.tblDeletions;
date2 = input(AdmitDate,anydtdte10.);
format date2 date9.;
datec = put(date2,date9.);
hosp_mrn_adm=catx("_", ref_HospitalCode, MRN, datec);
run;
2 libname sql access "\\hosted\dph\IS\AppDev\acdcfiles\SAHR Data Queries.accdb";
ERROR: Connect: Could not find file '\\hosted\dph\IS\AppDev\acdcfiles\SAHR Data Queries.accdb'.
ERROR: Error in the LIBNAME statement.
3 data deltbl; set sql.tblDeletions;
ERROR: Libref SQL is not assigned.
4 date2 = input(AdmitDate,anydtdte10.);
5 format date2 date9.;
6 datec = put(date2,date9.);
7 hosp_mrn_adm=catx("_", ref_HospitalCode, MRN, datec);
8 run;
ERROR: Connect: Could not find file '\\hosted\dph\IS\AppDev\acdcfiles\SAHR Data Queries.accdb'.
From the POV of your SAS session, the file is not there. If you can find it with Windows Explorer, then most likely you work with a remote SAS server, and the network resource is not available there.
The computer your SAS job is running on cannot find the path and / or file \\hosted\dph\IS\AppDev\acdcfiles\SAHR Data Queries.accdb. If the computer is a remote server then a folder share needs to added for \\hosted\dph\IS\AppDev\acdcfiles. If SAS is running on your PC then you can test if you have access to the path by pasting it into Windows Explorer.
ERROR: Connect: Could not find file '\\hosted\dph\IS\AppDev\acdcfiles\SAHR Data Queries.accdb'.
From the POV of your SAS session, the file is not there. If you can find it with Windows Explorer, then most likely you work with a remote SAS server, and the network resource is not available there.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.