options validvarname=any;
libname apple 'C:\Users\liaodong\Documents\My SAS Files\Wages.xls';
proc means data = apple.'Permanent$'n mean;
var wage;
run;
message in log:
39 options validvarname=any;
40 libname apple xlsx 'C:\Users\liaodong\Documents\My SAS Files\Wages.xls';
ERROR: Invalid physical name for library APPLE.
ERROR: Error in the LIBNAME statement.
41 proc means data = apple.'Permanent$'n mean;
ERROR: Libref APPLE is not assigned.
42 var wage;
ERROR: No data set open to look up variables.
43 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
40 libname apple xlsx 'C:\Users\liaodong\Documents\My SAS Files\Wages.xls'; ERROR: Invalid physical name for library APPLE. ERROR: Error in the LIBNAME statement.
The file does not exist. You have used the wrong file name or folder name (or both).
You screen capture is too small to read.
Also, for .XLS files, I think you need to use the EXCEL engine and not the XLSX engine.
The excel engine doesn't work .
@tianerhu wrote:
The excel engine doesn't work .
Saying it "doesn't work" is not helpful. Show us the LOG (including the actual code and any ERROR messages) you are using that doesn't work.
options validvarname=any;
libname apple 'C:\Users\liaodong\Documents\My SAS Files\Wages.xls';
proc means data = apple.'Permanent$'n mean;
var wage;
run;
message in log:
39 options validvarname=any;
40 libname apple xlsx 'C:\Users\liaodong\Documents\My SAS Files\Wages.xls';
ERROR: Invalid physical name for library APPLE.
ERROR: Error in the LIBNAME statement.
41 proc means data = apple.'Permanent$'n mean;
ERROR: Libref APPLE is not assigned.
42 var wage;
ERROR: No data set open to look up variables.
43 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
You left out the ENGINE name
libname apple excel 'C:\Users\liaodong\Documents\My SAS Files\Wages.xls';
I have try it , doesn't work.
@tianerhu wrote:
I have try it , doesn't work.
As I stated before (and I shouldn't have to ask multiple times), SHOW US THE LOG.
Thank you for your help.
Which version of SAS are you using? SAS University Edition requires files to be in the shared folder set up when installed and does not use Windows file syntax because it runs in a virtual machine using UNIX/Linux file syntax.
If you are connecting to server then the server does not see your local hard drive and the file needs to be moved to where the server can see it.
If using SAS On Demand For Academics that is a server version and needs to have the file uploaded to be used.
Thank you for your help.
@PaigeMiller wrote:
You screen capture is too small to read.
Also, for .XLS files, I think you need to use the EXCEL engine and not the XLSX engine.
And a license for SAS/Access Interface to PC File formats
If you run this code:
Proc setinit; run;
And the LOG does not show something similar to
---SAS/ACCESS Interface to PC Files
then you do not have a license and need one.
but the context in the book do not tell like things about SAS/PC format file ?
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.