BookmarkSubscribeRSS Feed
nlen
Fluorite | Level 6

I'm a long-time SAS user, but an EMACS newbie. Having successfully
installed Vincent Goulet's EMACS Modified for Windows on my WIN10 64 bit
system, I'm now trying to install EMACS ESS for SAS. Part of this seems
to be working, because I now get colorized text in my SAS source code
files. But I don't seem to be able to execute SAS inself. Part of what
is evidently required here is for me to define SAS to ESS by putting the
following line in my .EMACS file:

(setq ess-sas-submit-command "C:/program files (x86)/SAS Institute/SAS/V9/sas.exe")

I've done this, but when I load a SAS file into a buffer and type

M-x ess-sas-submit-command

I get the response

[No Match]

This has me stumped. I know the DOS command to run SAS works on my system,
because I've tried it. Does anyone have a suggestion?

12 REPLIES 12
ChrisNZ
Tourmaline | Level 20

Why do you use forward slashes in your command?

nlen
Fluorite | Level 6

Hi Chris - thanks for your response.  I thought that was what I was supposed to do.  Should I use something else?  I tried double forward slashes and got the same error message.  I tried reverse slashes and got "error: invalid escape character sequence" on loading emacs.

Tom
Super User Tom
Super User

I think the quotes you have are being read by the lisp processor.  You need to include quotes for the Windows/DOS command processor also because your path includes spaces.  Not sure if lisp use an escape character, like Unix command shell.

(setq ess-sas-submit-command "\"C:/program files (x86)/SAS Institute/SAS/V9/sas.exe\"")

Or doubles the quotes, like SAS.

(setq ess-sas-submit-command """C:/program files (x86)/SAS Institute/SAS/V9/sas.exe""")

You also might need to use \ to escape the \ in your DOS command.

 

(setq ess-sas-submit-command "\"C:\\program files (x86)\\SAS Institute\\SAS\\V9\\sas.exe\"")
nlen
Fluorite | Level 6
Hi Tom -

Thanks for your suggestions. Unfortunately, no luck. That is, for the
first and third suggestions, I still get [no match] when trying to
execute ess-sas-submit-command.

For the second suggestion, I get the following error message on loading
emacs:

Warning (initialization): An error occurred while loading
'c:/Users/nleno/.emacs' Wrong type argument" sym,bolp. C:program files
(x86)/SAS Institute/SAS/V9/sas.exe
ChrisNZ
Tourmaline | Level 20

@Tom made 2 suggestions for change:

- Quote the complete path since it contains spaces

- Use \, not /, and escape it

 

He showed various ways to do this, since different environments use different syntaxes.

 

You must implement both suggestions: quote the path, and use \ instead of /.

nlen
Fluorite | Level 6

Hi Chris -

I executed Tom's suggestions exactly as he wrote them.

If you have other ideas, please quote them, and I will try them, too.

Neal

ChrisNZ
Tourmaline | Level 20

> I executed Tom's suggestions exactly as he wrote them.

That's my point exactly. He suggested corrections for quoting, and then for using the \. Separately.

You have to use both.

 

> If you have other ideas, please quote them, and I will try them, too.

Why don't you try? You might learn something.

Plus we can't guess the exact syntax that will work for your exact case.

 

 

Tom
Super User Tom
Super User

@nlen wrote:

Hi Chris -

I executed Tom's suggestions exactly as he wrote them.

If you have other ideas, please quote them, and I will try them, too.

Neal


Does Windows still support shortnames for folders/files with goofy invalid characters like spaces in them?  That is how the example in the documentation does it.  http://ess.r-project.org/Manual/ess.html#ESS_0028SAS_0029_002d_002dBatch-SAS-processes

;Windows example
(setq-default ess-sas-submit-command "c:\\progra~1\\sas\\sas.exe")

Notice the progra~1  that is the shortname for the Program Files.

The /X option on the DIR command should let you find the shortname for your SAS version on your PC.

nlen
Fluorite | Level 6

Boy, Tom, I really thought that was going to be it. 
But again, I get the dreaded [no match] response.
On my system, I used:

 

(setq-default ess-sas-submit-command "c:\\PROGRA~2\\SASINS~1\\SAS\\V9\\sas.exe")

 

I know the quoted part works, because it loaded SAS when I put it in a .bat file.
Thanks for the suggestion!
Neal

nlen
Fluorite | Level 6

PS:

I also tried

(setq ess-sas-submit-command "\"c:\\PROGRA~2\\SASINS~1\\SAS\\V9\\sas.exe\"")

No soap.

ChrisNZ
Tourmaline | Level 20

This page suggests that the command should use setq-default

(setq-default ess-sas-submit-command "c:\\progra~1\\sas\\sas.exe")

 not setq

StevenT
Calcite | Level 5

This was quite troublesome for me too (Windows 10, Emacs from Vincent Goulet). The tip from Tom was very helpful (finding the shortnames in Windows 10 with dir /X). What eventually worked for me was

 

a) using the F3/F4/F5/  keys (not the commands in de ESS menu)

b) after having the following in my  .../.emacs.d/init.el  file: 

 

(setq ess-sas-local-unix-keys t)

(setq-default ess-sas-submit-command "C:\\PROGRA~1\\SASHome\\SASFoundation\\9.4\\sas.exe")

 

Then on opening a SAS file in Emacs, ESS-mode is loaded and after pressing F3 the program is run... but I have to wait 5 seconds before it starts (next times it works faster). 

 

The shell buffer gives me the following code:

*** start screenshot ***

Microsoft Windows [Version 10.0.18362.1016]
(c) 2019 Microsoft Corporation. All rights reserved.

c:\Users\Steven\Desktop\emacs and SAS>c:
cd "c:/Users/Steven/Desktop/emacs and SAS/"
start C:\PROGRA~1\SASHome\SASFoundation\9.4\sas.exe -sysin "test" -rsasuser -icon
c:

c:\Users\Steven\Desktop\emacs and SAS>cd "c:/Users/Steven/Desktop/emacs and SAS/"

c:\Users\Steven\Desktop\emacs and SAS>start C:\PROGRA~1\SASHome\SASFoundation\9.4\sas.exe -sysin "test" -rsasuser -icon

c:\Users\Steven\Desktop\emacs and SAS>

*** end screen shot ***

 

Apparently the 

;'ms-dos default
(setq ess-sas-submit-pre-command "start")
;'ms-dos default
(setq ess-sas-submit-post-command "-rsasuser -icon")

are used as well to run SAS.

From what I get from what I found on the internet, interactive mode will not work with Windows, only the above batch mode. 

 

 

 

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
  • 12 replies
  • 2640 views
  • 2 likes
  • 4 in conversation