BookmarkSubscribeRSS Feed
rickw
Calcite | Level 5
Hi,

I am currently using SAS EG 4.2 and I get weird error on trying to run simple proc import :


proc import out = temp datafile = "C:\Users\Downloads\Temp.xls"
dbms = xls replace ;
sheet = combined;
run;

ERROR: Physical file does not exist

Would be great if you guys could help me with this.

Also, is there any way I could import all the tabs in my excel files into sas tables with name corresponding to each tab name ??



Thanks.
5 REPLIES 5
Ksharp
Super User
Hi.
The log displays ERROR: Physical file does not exist. maybe temp.xls is not the right path.


>Also, is there any way I could import all the tabs in my excel files into sas tables with name corresponding to each tab name ??


Sure.you need "libname x excel 'xxxx' " statement to assign a libname to excel file ,then use 'proc sql ......from dictionary.tables' to yield the sheet name in that xls file.then use %do macro .


Ksharp
rickw
Calcite | Level 5
Thanks

I had one more question ...

The variable names I get after import are all having special characters like " : % ( ) , # .. however, I want the imported columns to follow the SAS variable naming convention is there any option for that ?? Message was edited by: rickw
Ksharp
Super User
Yes.
There is a system option ' options validvarname=any ' can use any special character for variable name (only available for Base and Stat).
If you do not want, can close it or change it.

Ksharp
rickw
Calcite | Level 5
I actually meant that I want to follow the SAS naming rules that is having underscore instead of special characters ...

When I import the data it is not getting converted to variable naming convention this is just happening for excel files...

when I import csv files the variable names are following the SAS naming convention...

I tried options validvarname = v7..

but that gives some error ..

ERROR: The value Assigned To: Full Name is not a valid SAS name.

Thanks.
Ksharp
Super User
Hi.
I try it.
In fact, SAS will use your illegal variable name as label.And variable is actually converted successful.

If you add another options ' options nolabel ; ' then you will find SAS has already convert varname as the rule of V7.

Or use proc contents to see it deeply.


Ksharp

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1478 views
  • 0 likes
  • 2 in conversation