BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vraj1
Quartz | Level 8

i want to import .xlsm file using proc import.

when i did using the below code, i get the following error.

proc import
datafile="&workdir./progplan.xlsm"
out = import_progplan
dbms = excelcs replace;
sheet = "Programming Plan";
getnames=yes;
mixed=no;
run;

 

mixed=no; run;
_____
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

ERROR: Statement or Option "GETNAMES" not valid for EXCELCS IMPORT.

 

Can anyone help me

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

EXCELCS requires the SAS/ACCESS to PC Files component "PC FIles Server".  If you're running SAS for Windows, that should autostart -- though it might need some configuration.  And you'll have to make sure it's installed.

 

On SAS for UNIX, you need to have PC Files Server on a Windows node in your network, then specify that node as part of the PROC IMPORT statement -- this is how Excel-specific behaviors can be delegated from SAS on UNIX to the Excel engine.  Note that you don't need this in place for the more common XLSX files -- DBMS=XLSX works without it.  But for macro-enabled XLSM files, you need to push the work to this specific Excel engine using EXCELCS and the PC Files Server.

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

View solution in original post

7 REPLIES 7
LinusH
Tourmaline | Level 20
vraj1
Quartz | Level 8

i added the below code but still get error.

proc import
datafile="&workdir./progplan.xlsm"
out = import_progplan
dbms = excelcs replace;
sheet = "Programming Plan";
range='test1$a2:e21'n;

run;

ERROR: Server Name is invalid or missing.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Are you using SAS University Edition?

vraj1
Quartz | Level 8

No, its SAS Unix

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Simplify your process.  Save the "data" to a "data transfer" format e.g. CSV or XML.  Then write a simple data step import program.  This will then be robust, cross platform, easy to maintain etc.  Excel is not a good data transfer format, it is proprietary (i.e. there is no Office for Unix) - so not cross platform, nor is it easy to read without that software, nor is it strcutured data.  

ChrisHemedinger
Community Manager

EXCELCS requires the SAS/ACCESS to PC Files component "PC FIles Server".  If you're running SAS for Windows, that should autostart -- though it might need some configuration.  And you'll have to make sure it's installed.

 

On SAS for UNIX, you need to have PC Files Server on a Windows node in your network, then specify that node as part of the PROC IMPORT statement -- this is how Excel-specific behaviors can be delegated from SAS on UNIX to the Excel engine.  Note that you don't need this in place for the more common XLSX files -- DBMS=XLSX works without it.  But for macro-enabled XLSM files, you need to push the work to this specific Excel engine using EXCELCS and the PC Files Server.

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
reddaniel
Calcite | Level 5

Hi, I'm stuck with a similar error. I'm trying to import data from a .XSLX. and while I execute the PROC IMPORT I get this error: "ERROR: Server Name is invalid or missing." 

 

This file is placed in a shared folder with a path like this: \\file_server_name\folder\subfolder, I'm using SAS Enterprise Guide 7.1 and I guess we are using a UNIX server for the metadata because in the LOG of the import task the INFILE has this path: '/sasendwork/work/SAS_work722C01660016_sas_server_name/#LN00014'

 

I need to import files using code because I have to upload a daily report placed in this shared folder that has a date in the name, something like 'File mm-dd-yyy.xlsx'

 

I tried a lot of things but I guess most of all solutions are intended for SAS 9.1 or later versions. 

 

Any help will be very appreciate since we expent a lot of time updating the import task everyday.

 

Regards,

 

-Daniel

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 26941 views
  • 1 like
  • 5 in conversation