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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1110 views
  • 0 likes
  • 2 in conversation