User manual

Chapter 13: ESS for SAS 69
13.3 ESS[SAS]–TAB key
Two options. The TAB key is bound by default to sas-indent-line. This function is used
to syntactically indent SAS code so PROC and RUN are in the left margin, other statements are
indented sas-indent-width spaces from the margin, continuation lines are indented sas-
indent-width spaces in from the beginning column of that statement. This is the type of
functionality that emacs provides in most programming language modes. This functionality
is activated by placing the following line in your initialization file prior to a require/load:
(setq ess-sas-edit-keys-toggle nil)
ESS provides an alternate behavior for TAB that makes it behave as it does in SAS
Display Manager, i.e. move the cursor to the next stop. The alternate behavior also provides
a "TAB" backwards, C-TAB, that moves the cursor to the stop to the left and deletes any
characters between them. This functionality is obtained by placing the following line in
your initialization file prior to a require/load:
(setq ess-sas-edit-keys-toggle t)
Under the alternate behavior, TAB is bound to M-x tab-to-tab-stop and the stops are
defined by ess-sas-tab-stop-list.
13.4 ESS[SAS]–Batch SAS processes
Submission of a SAS batch job is dependent on your environment. ess-sas-submit-method
is determined by your operating system and your shell. It defaults to ’sh unless you are
running Windows or Mac Classic. Under Windows, it will default to ’sh if you are using
a UNIX-imitating shell; otherwise ’ms-dos for an MS-DOS shell. On Mac OS X, it will
default to ’sh, but under Mac Classic, it defaults to ’apple-script. You will also set
this to ’sh if the SAS batch job needs to run on a remote machine rather than your local
machine. This works transparently if you are editing the remote file via ange-ftp/EFS or
tramp. Note that ess-sas-shell-buffer-remote-init is a Local Variable that defaults
to "ssh" which will be used to open the buffer on the remote host and it is assumed that
no password is necessary, i.e. you are using ssh-agent/ssh-add or the equivalent (see the
discussion about Local Variables below if you need to change the default).
However, if you are editing the file locally and transferring it back and forth with Kermit,
you need some additional steps. First, start Kermit locally before remotely logging in. Open
a local copy of the file with the ess-kermit-prefix character prepended (the default is
"#"). Execute the command M-x ess-kermit-get which automatically brings the contents
of the remote file into your local copy. If you transfer files with Kermit manually in a
*shell*’ buffer, then note that the Kermit escape sequence is C-q C-\ c rather than C-\ c
which it would be in an ordinary terminal application, i.e. not in an emacs buffer. Lastly,
note that the remote Kermit command is specified by ess-kermit-command.
The command used by the SUBMIT function key (F3 or F8) to submit a batch SAS
job, whether local or remote, is ess-sas-submit-command which defaults to sas-program.
sas-program is "invoke SAS using program file" for Mac Classic and "sas" otherwise.
However, you may have to alter ess-sas-submit-command for a particular program, so it
is defined as buffer-local. Conveniently, it can be set at the end of the program:
endsas;
Local variables: