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

 

Hello There,

 

I am attempting to open up an excel document using an x command. I am currently not getting any errors, the code is running to completion, however, nothing is happening upon completion of the code.

 

The document lives on a shared directory, and is in a virtual environment. We are not sure if either of these are causing the issue. Other x commands are functioning (creating or deleting items), so we can at least confirm that the xcmd functionality is working.

 

Any recommendations would be highly appreciated.

 

Thanks!

 

Code used below:

 

proc options option=xcmd; run;

options noxwait noxsync;

x '"directory\x_experiments\DelimitedExample"';

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

As long as you are logging on to a Windows session on your virtual PC, then running SAS within this session then opening an Excel session should work. In essence Excel needs a display, virtual or real, to successfully start. No display, no Excel. This is different from using SAS to read or write Excel workbooks. In this case you aren't using Excel sessions. 

View solution in original post

11 REPLIES 11
Reeza
Super User
Did you test your x command in a command window? That doesn't look correct to open an XLSX file, there's no file extension for one or a filename.
acooper
Calcite | Level 5

Howdy!

 

the file name is included (DelimitedExample). I had seen the extension left off in other threads, so I had left it off in my experiments to get it to work.

 

playing around with the command prompt now to try and get it to work in a different file first. would I be using .exe or .xlsx?

 

thank you!

SASKiwi
PROC Star

Where is your SAS program running? This will only work if it is running on your PC. If the program is running on a remote SAS server, then you can't start a local Excel session from there.

acooper
Calcite | Level 5

okay, that may unfortunately be (one of) the issues. Our system is running on a virtual environment and not on the main computer.

 

as noted earlier, other x commands are working correctly (creating or destroying folders and txt documents), is there a way to tell which x commands would or would not work on a virtual environment?

Reeza
Super User
The x commands are executed in the virtual environment and will only affect the VM. Anything locally will not be accessible.
acooper
Calcite | Level 5

that is fine, I don't need to open anything on the local machine, im trying to open a document that also lives in the virtual environment.

SASKiwi
PROC Star

As long as you are logging on to a Windows session on your virtual PC, then running SAS within this session then opening an Excel session should work. In essence Excel needs a display, virtual or real, to successfully start. No display, no Excel. This is different from using SAS to read or write Excel workbooks. In this case you aren't using Excel sessions. 

acooper
Calcite | Level 5

thank you!

 

I will continue to play around with it and return if I am still having issues.

Reeza
Super User
Your slashes indicate unix, are you working on a unix machine and does it have Excel installed?
acooper
Calcite | Level 5

excel is installed, this is being run on windows, not unix. what would you change in the formatting?

 

thanks!

ballardw
Super User

FWIW when I run

x 'x:\data\junk.xlsx';

the desired file opens. This is running SAS locally on a Windows10 machine.

 

No file extension, i.e. the XLSX part and the only thing that happens is a command prompt window opening.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 11 replies
  • 1613 views
  • 1 like
  • 4 in conversation