Hi,
Why the below import does not work.
PROC IMPORT DATAFILE = 'N:\Comp1\SubComp1\ISS5315\ISS-5315 dds impacted with info from Product catalogue GG Update.xlsx'
OUT = list1
DBMS = XLSX
REPLACE;
SHEET = "Sheet1";
GETNAMES = YES;
RUN;
I get the below error:
ERROR: Physical file does not exist, N:\Comp1\SubComp1\ISS5315\ISS-5315 dds impacted with info from Product catalogue GG Update.
Thanks.
Then first verify that the path to the directory is correct, and create a directory listing:
data files;
length dref $8 name $200;
rc = filename(dref,"N:\Comp1\SubComp1\ISS5315");
did = dopen(dref);
if did
then do;
do i = 1 to dnum(did);
name = dread(did,i);
output;
end;
rc = dclose(did);
end;
else putlog "Directory not found!";
drop rc did dref;
run;
If this does not work as expected, post the complete log.
Most probable cause: the N drive is not available on the server where SAS runs. Try to use a UNC path instead, or have your SAS server admins mount the network share.
Then first verify that the path to the directory is correct, and create a directory listing:
data files;
length dref $8 name $200;
rc = filename(dref,"N:\Comp1\SubComp1\ISS5315");
did = dopen(dref);
if did
then do;
do i = 1 to dnum(did);
name = dread(did,i);
output;
end;
rc = dclose(did);
end;
else putlog "Directory not found!";
drop rc did dref;
run;
If this does not work as expected, post the complete log.
It worked and the file name is in the dataset.
Then make sure that you use the same name in the PROC IMPORT as returned by the directory listing; if in doubt, look at a hex-formatted display of the filename to find any "funny" characters (like a leading blank).
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.