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.

 

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

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.

 

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 28466 views
  • 1 like
  • 5 in conversation