[ESS] ess, SAS, and MS Windows 7
rsparapa at mcw.edu
Fri Mar 19 14:39:53 CET 2010
On 03/19/10 12:39 AM, Paul Johnson wrote:
> I'm not a Windows guy. I keep telling everybody that. But I keep
> getting drafted to setup Windows systems. So I have to show up here
> asking about how to use Emacs in Windows. Which is sorta like wearing
> a "kick-me" sign on the playground.
> But, in the end, I like setting up Windows because I install all the
> free programs I like! If you try hard enough, you can make MS Windows
> look quite a bit like the Gnome desktop :)
> Anyway, I've got a bunch of Win 7 systems and they have 64bit SAS-9.2.
> Seems to run OK.
> Also, we have R, and just for fun I wrote a script that downloads and
> installs every single package on CRAN. It only uses about 2.5 GB of
> disk space (as of 2010-03-12).
> I've also installed Prof Goulet's Emacs for Windows, and that's fun too.
> I'm trying to make Emacs work with SAS in Windows. I really did read
> the manual, even though I still seem not to know anything. I see that
> ESS interactive does not work in Windows. But, the SAS batch mode
> does work, and there is a hint that a "one way" interactive mode may
> work as well.
> About the batch mode.
> The Batch mode is a bit tricky. I put in several elements in the ESS
> site-start file. I cribbed these out of the ESS-SAS part of the info
> (setq ess-sas-edit-keys-toggle nil)
> ;Windows example
> (setq-default ess-sas-submit-command "c:/Program
> ;;2; (setq ess-sas-local-unix-keys t)
> ;;(setq ess-sas-local-pc-keys t)
> ;;4; (setq ess-sas-global-unix-keys t)
> (setq ess-sas-global-pc-keys t)
> I wrote some sas commands, hit F8, and, to my astonishment, the sas
> startup splash appeared, the program ran, and Emacs left me in a
> shell. It appears to be a MS Command Shell, it answers to "dir" and
I'm a little rusty on my Windows command line, but there are some
interesting things that you can do. If you don't know about them,
don't worry about it :o)
> What am I supposed to do in that shell? Anybody? Aside from creating
> an irritating "open sessions" warning when you try to close EMACS, I
> can't see any purpose in it.
> The FN keys are supposed to work universally, but they don't work to
> transport me to the other SAS files. They work while I'm in ESS-SAS
> mode in the buffer "myfile.SAS". F8 sends the job to SAS batch. But
> after, F6 should take me to the SAS log file, F7 to the lst file, but
> when I hit those keys, the Emacs status says<F6> not defined.
> It may be I'm "punch drunk" now and it will all seem clear to me in
> the morning. But I doubt it. Do I configure Emacs so that files with
> suffixes log and lst are open in ESS-SAS mode files?
It looks like you stopped reading before the most important part:
;;2; (setq ess-sas-local-unix-keys t)
;;3; (setq ess-sas-local-pc-keys t)
;;4; (setq ess-sas-global-unix-keys t)
;;5; (setq ess-sas-global-pc-keys t)
The names `-unix-' and `-pc-' have nothing to do with the
operating system that you are running. Rather, they mimic the
definitions that the SAS Display Manager uses by default on those
b. If your site installation has configured the keys contrary to your
liking, then you must call the appropriate function.
(load "ess-site") ;; local-unix-keys
> Now, about the one-way interactive mode, pushing commands from Emacs to SAS.
> In section 10.9 of ESS info "ESS(SAS) Windows" it says:
> " Or you can mark regions with the mouse and submit the code with
> `submit-region' or paste them into SAS Display Manager.
> I can paste :) But the part before the "or" aboutthe 'submit-region'
> thing has me stumped. How does the code get from Emacs into the SAS
Maybe you should read the whole section :o) Picking up where we
left off above...
Finally, we get to what the function keys actually do. You may
recognize some of the nicknames as SAS Display Manager commands (they
are in all capitals).
UNIX PC Nickname
<F2> <F2> `refresh'
revert the current buffer with the file of the same
name if the file is newer than the buffer
<F3> <F8> `SUBMIT'
save the current `.sas' file (which is either the `.sas'
file in the current buffer or the `.sas' file associated
with the `.lst' or `.log' file in the current buffer)
and submit the file as a batch SAS job
<F4> <F5> `PROGRAM'
switch buffer to `.sas' file
<F5> <F6> `LOG'
switch buffer to `.log' file, `refresh' and goto next
error message, if any
<F6> <F7> `OUTPUT'
switch buffer to `.lst' file and `refresh'
<F7> <F4> `filetype-1'
switch buffer to `filetype-1' (defaults to `.txt') file
<F8> <F3> `shell'
switch buffer to `*shell*'
<F9> <F9> `VIEWTABLE'
open an interactive `PROC FSEDIT' session on the SAS
dataset near point
<F10> <F10> toggle-log
toggle ESS[SAS] for `.log' files; useful for certain
<F11> <F11> `filetype-2'
switch buffer to `filetype-2' (defaults to `.dat') file
<F12> <F12> viewgraph
open a `GSASFILE' near point for viewing either in emacs
or with an external viewer
`C-<F1>' `C-<F1>' rtf-portrait
create an MS RTF portrait file from the current buffer
with a file extension of `.rtf'
`C-<F2>' `C-<F2>' rtf-landscape
create an MS RTF landscape file from the current buffer
with a file extension of `.rtf'
`C-<F3>' `C-<F8>' submit-region
write region to `ess-temp.sas' and submit
`C-<F5>' `C-<F6>' append-to-log
append `ess-temp.log' to the current `.log' file
`C-<F6>' `C-<F7>' append-to-output
append `ess-temp.lst' to the current `.lst' file
`C-<F9>' `C-<F9>' `INSIGHT'
open an interactive `PROC INSIGHT' session on the SAS
dataset near point
toggle ESS[SAS] for `.lst' files; useful for toggling
So you want, C-F3 for submit region.
More information about the ESS-help