44
46
files are automatically refreshed with each keypress).
47
ESS[SAS] is automatically turned on when editing a file with a ".sas"
48
suffix (or other, if specified in ess-site via auto-mode-alist). The batch
49
processing keypress commands can be enabled to use the same function keys that the
50
SAS Display Manager does. The interactive capabilities of ESS require you to
51
start an inferior SAS process with M-x SAS
49
ESS[SAS] is automatically turned on when editing a file with a .sas
50
suffix (or other extension, if specified via auto-mode-alist). The function
51
keys can be enabled to use the same function keys that
52
the SAS Display Manager does. The interactive capabilities of ESS require you
53
to start an inferior SAS process with M-x SAS
52
54
(@xref{iESS(SAS)--Interactive SAS processes}.)
54
At this writing, the indenting and syntax highlighting are generally
55
correct. Known issues: for multiple line * or %*
56
comments, only the first line is highlighted; for .log files, only the first
57
line of a NOTE:, WARNING: or ERROR: message is highlighted; unmatched single/double
58
quotes in CARDS data lines are NOT ignored.
60
@comment node-name, next, previous, up
61
@node iESS(SAS)--Interactive SAS processes, ESS(SAS)--Batch SAS processes, ESS(SAS)--Editing files, Help for SAS
62
@section iESS[SAS]--Interactive SAS processes
64
iESS (inferior ESS) is the method for interfacing with interactive
65
statistical processes (programs). iESS[SAS] is what is needed for
66
interactive SAS programming. iESS[SAS] works best
67
with the following settings for SAS command-line options
68
(the default of inferior-SAS-args):
71
-stdio -linesize 80 -noovp -nosyntaxcheck
75
-stdio required to make the redirection of stdio work
76
-linesize 80 keeps output lines from folding on standard terminals
77
-noovp prevents error messages from printing 3 times
78
-nosyntaxcheck permits recovery after syntax errors
81
To start up iESS[SAS] mode, use:
86
The *SAS:1.log* buffer in ESStr mode corresponds to the file
87
myfile.log in SAS batch usage and to the "SAS: LOG" window in the SAS
88
Display Manager. All commands submitted to SAS, informative
89
messages, warnings, and errors appear here.
91
The *SAS:1.lst* buffer in ESSlst mode corresponds to the file
92
myfile.lst in SAS batch usage and to the "SAS: OUTPUT" window in the
93
SAS Display Manager. All data related printed output from the
94
PROCs appear in this window.
96
The iESS [SAS:1] buffer exists solely as a communications buffer.
97
Files are edited in the myfile.sas buffer. The C-c C-r key in
98
ESS[SAS] is the functional equivalent of bringing a file into the
99
"SAS: PROGRAM EDITOR" window followed by the 'Local' 'Submit' menu
100
commands. The user should never use this buffer directly.
102
@c DANGER Will Robinson!
105
@c - The ability to request help from a process for variables and
106
@c functions, and to have the results sent into a separate buffer.
107
@c - completion of object names and file names.
110
Troubleshooting: @xref{iESS(SAS)--Common problems}.
112
@comment node-name, next, previous, up
113
@node ESS(SAS)--Batch SAS processes, ESS(SAS)--Function keys for batch processing, iESS(SAS)--Interactive SAS processes, Help for SAS
56
At this writing, the indenting and syntax highlighting are generally
57
correct. Known issues: for multiple line * or %* comments, only the
58
first line is highlighted; for .log files, only the first line of a
59
NOTE:, WARNING: or ERROR: message is highlighted; unmatched
60
single/double quotes in CARDS data lines are NOT ignored; in a DO ... TO
61
or a DO ... TO ... BY statement, TOs are not highlighted (and neither is
64
@comment node-name, next, previous, up
65
@node ESS(SAS)--TAB key, ESS(SAS)--Batch SAS processes, ESS(SAS)--Editing files, ESS for SAS
66
@section ESS[SAS]--TAB key
68
Two options. The TAB key is bound by default to sas-indent-line. This
69
function is used to syntactically indent SAS code so PROC and RUN are in
70
the left margin, other statements are indented 4 spaces from the margin,
71
continuation lines are indented 4 spaces in from the beginning column of
72
that statement. This is the type of functionality that emacs provides
73
in most programming language modes. This functionality is equivalent to
74
uncommenting the following line in ess-site.el:
76
(setq ess-sas-edit-keys-toggle nil)
79
ESS provides an alternate behavior for the TAB key that makes it behave
80
as it does in SAS Display Manager, i.e. move the cursor to the next tab
81
stop. The alternate behavior also provides a backwards TAB, C-TAB, that
82
moves the cursor to the tab stop to the left and deletes any characters
83
between them. This functionality is obtained by uncommenting the
84
following line in ess-site.el:
86
(setq ess-sas-edit-keys-toggle t)
88
Under the alternate behavior, the TAB key is bound to tab-to-tab-stop
89
and the tab stops are set at multiples of sas-indent-width.
91
@comment node-name, next, previous, up
92
@node ESS(SAS)--Batch SAS processes, ESS(SAS)--Function keys for batch processing, ESS(SAS)--TAB key, ESS for SAS
114
93
@section ESS[SAS]--Batch SAS processes
116
Submission of a SAS batch job is dependent on your environment.
117
ess-sas-submit-method is determined by your operating system and your shell.
118
It defaults to 'sh unless you are running Windows or Mac Classic. Under Windows,
119
it will default to 'sh if you are using bash for your shell rather than
120
MS-DOS ('ms-dos). On Mac OS X, it will default to 'sh, but under Mac Classic
121
AppleScript is used ('apple-script). You will also set this to 'sh if the SAS batch
122
job needs to run on a remote machine rather than your local machine. This works
123
transparently if you are editing the remote file via ange-ftp/EFS or tramp.
124
However, if you are editing the file locally and transferring it back and forth
125
with Kermit, you need some additional steps. First of all, start Kermit locally
126
before remotely logging in. Open a local copy of the file with the
127
ess-kermit-prefix character prepended (the default is "#"). Execute the command
128
ess-kermit-get which brings the contents of the remote file into your local copy.
129
Also, note that the remote Kermit command is defined by ess-kermit-command.
131
The command used by the SUBMIT function key (F3 or F8) to submit a batch SAS
132
job, whether local or remote, is ess-sas-submit-command which defaults to sas-program. sas-program is
133
"invoke SAS using program file" for Mac Classic and "sas" otherwise. However,
134
you may have to alter ess-sas-submit-command for a particular program, so it is
135
defined as buffer-local (conveniently, you can set it in Local Variables: at
136
the end of your program). The command line is also made of
137
ess-sas-submit-pre-command, ess-sas-submit-post-command and
138
ess-sas-submit-command-options (the last of which is also buffer-local).
95
Submission of a SAS batch job is dependent on your environment.
96
ess-sas-submit-method is determined by your operating system and your
97
shell. It defaults to 'sh unless you are running Windows or Mac
98
Classic. Under Windows, it will default to 'sh if you are using a
99
Unix-imitating shell; otherwise 'ms-dos for an MS-DOS shell. On Mac OS
100
X, it will default to 'sh, but under Mac Classic AppleScript is used
101
('apple-script). You will also set this to 'sh if the SAS batch job
102
needs to run on a remote machine rather than your local machine. This
103
works transparently if you are editing the remote file via ange-ftp/EFS
104
or tramp. Note that ess-sas-shell-buffer-remote-init is a Local
105
Variable that defaults to "ssh" which will be used to open the buffer on
106
the remote host and it is assumed that no password is necessary,
107
i.e. you are using the equivalent of ssh-agent/ssh-add (see the
108
discussion about Local Variables below if you need to change the
111
However, if you are editing the file locally and transferring it back
112
and forth with Kermit, you need some additional steps. First, start
113
Kermit locally before remotely logging in. Open a local copy of the
114
file with the ess-kermit-prefix character prepended (the default is
115
"#"). Execute the command ess-kermit-get which automatically brings the
116
contents of the remote file into your local copy. If you transfer files
117
with Kermit manually in a shell buffer, then note that the Kermit escape
118
sequence is C-q C-\ c rather than C-\ c which it would be in an ordinary
119
terminal application, i.e. not in an emacs buffer. Lastly, note that
120
the remote Kermit command is specified by ess-kermit-command.
122
The command used by the SUBMIT function key (F3 or F8) to submit a batch
123
SAS job, whether local or remote, is ess-sas-submit-command which
124
defaults to sas-program. sas-program is "invoke SAS using program file"
125
for Mac Classic and "sas" otherwise. However, you may have to alter
126
ess-sas-submit-command for a particular program, so it is defined as
127
buffer-local. Conveniently, it can be set at the end of the program:
131
ess-sas-submit-command: "sas8"
135
The command line is also made of ess-sas-submit-pre-command,
136
ess-sas-submit-post-command and ess-sas-submit-command-options
137
(the last of which is also buffer-local).
139
138
Here are some examples for your .emacs file (you may also use
140
M-x customize-variable with):
139
M-x customize-variable):
142
(setq ess-sas-submit-pre-command "nohup") ;'sh default
143
(setq ess-sas-submit-post-command "-rsasuser &") ;'sh default
144
(setq ess-sas-submit-command "/usr/local/sas/sas") ;'sh example
145
(setq ess-sas-submit-pre-command "start") ;'ms-dos default
146
(setq ess-sas-submit-post-command "-rsasuser -icon") ;'ms-dos default
147
(setq ess-sas-submit-command "c:/progra~1/sas/sas.exe") ;Windows example
148
(setq ess-sas-submit-command "c:\\progra~1\\sas\\sas.exe");Windows example
142
(setq ess-sas-submit-pre-command "nohup")
144
(setq ess-sas-submit-post-command "-rsasuser &")
146
(setq-default ess-sas-submit-command "/usr/local/sas/sas")
148
(setq ess-sas-submit-pre-command "start")
150
(setq ess-sas-submit-post-command "-rsasuser -icon")
152
(setq-default ess-sas-submit-command "c:/progra~1/sas/sas.exe")
154
(setq-default ess-sas-submit-command "c:\\progra~1\\sas\\sas.exe")
151
157
There is a built-in delay before a batch SAS job is submitted when using
152
a Unix shell under Windows. This is necessary in many cases
158
a Unix-imitating shell under Windows. This is necessary in many cases
153
159
since the shell might not be ready to receive a command. This delay is
154
160
currently set high enough so as not to be a problem. But,
155
161
there may be cases when it needs to be set higher, or could be set much
159
165
(setq ess-sleep-for 0.2)
168
For example, open the file you want to work with
169
(ess-sas-global-unix-keys keys shown, ess-sas-global-pc-keys in
170
parentheses; ESS[SAS] function keys are presented in the next section).
174
myfile.sas will be in ESS[SAS] mode. Edit as appropriate, then save and
175
submit the batch SAS job.
179
The job runs in the shell buffer while you continue to edit
180
myfile.sas. If ess-sas-submit-method is 'sh, then the
181
message buffer will display the shell notification when the
182
job is complete. The 'sh setting also allows you to
183
terminate the SAS batch job before it is finished.
187
Terminating a SAS batch in the *shell* buffer.
191
You may want to visit the .log (whether the job is still running
192
or it is finished) and check for error messages. The .log will be
193
refreshed and you will be placed in it's buffer. You will be
194
taken to the 1st error message, if any.
198
Goto the next error message, if any.
202
Now, refresh the .lst and go to it's buffer.
206
If you wish to make changes, go to the .sas file with.
210
Make your editing changes and submit again.
162
215
@comment node-name, next, previous, up
163
@node ESS(SAS)--Function keys for batch processing, ESS(SAS)--TAB key, ESS(SAS)--Batch SAS processes, Help for SAS
216
@node ESS(SAS)--Function keys for batch processing, iESS(SAS)--Interactive SAS processes, ESS(SAS)--Batch SAS processes, ESS for SAS
164
217
@section ESS[SAS]--Function keys for batch processing
166
219
The setup of function keys for SAS batch processing
167
220
is unavoidably complex, but the usage of function keys is simple.
168
221
There are five distinct options:
170
Option 1 (default). Function keys in ESS[SAS] are not bound to elisp commands.
171
This is in accordance with the GNU Elisp Coding Standards (GECS) which do
172
not allow function keys to be bound so that they are available to the user.
223
Option 1 (default). Function keys in ESS[SAS] are not bound to elisp
224
commands. This is in accordance with the GNU Elisp Coding Standards
225
(GECS) which do not allow function keys to be bound so that they are
226
available to the user.
174
Options 2-5. Since GECS does not allow function keys to be bound by modes,
175
these keys are often unused. So, ESS[SAS] provides
176
users with the option of binding elisp commands to these keys. Users
177
who are familiar with SAS will, most likely, want to duplicate the function
178
key capabilities of the SAS Display Manager. There are four options (noted
179
in parentheses below).
228
Options 2-5. Since GECS does not allow function keys to be bound by
229
modes, these keys are often unused. So, ESS[SAS] provides users with
230
the option of binding elisp commands to these keys. Users who are
231
familiar with SAS will, most likely, want to duplicate the function key
232
capabilities of the SAS Display Manager. There are four options (noted
183
SAS provides different function key definitions with its Unix (2, 4) and
184
Windows (3, 5) products; ESS can use either.
237
SAS Display Manager has different function key definitions for
238
Unix (2, 4) and Windows (3, 5); ESS can use either.
186
240
The ESS[SAS] function key definitions can be active in all buffers
187
(global: 4, 5) or limited (local: 2, 3) only to buffers with files that are
188
associated with ESS[SAS] as defined in your auto-mode-alist.
241
(global: 4, 5) or limited (local: 2, 3) only to buffers with files that
242
are associated with ESS[SAS] as specified in your auto-mode-alist.
191
The distinction between local and global is subtle. If you want
192
the ESS[SAS] definitions to work when you are in the *shell* buffer or when
193
editing files other than the file extensions that ESS[SAS] recognizes, you
194
will most likely want to use the global definitions.
195
If you want your function keys to understand SAS batch commands when you
196
are editing SAS files, and to behave normally when editing other files,
197
then you will choose the local definitions. The option can be chosen by
198
the person installing ESS for a site or by an individual.
245
The distinction between local and global is subtle. If you want the
246
ESS[SAS] definitions to work when you are in the *shell* buffer or when
247
editing files other than the file extensions that ESS[SAS] recognizes,
248
you will most likely want to use the global definitions. If you want
249
your function keys to understand SAS batch commands when you are editing
250
SAS files, and to behave normally when editing other files, then you
251
will choose the local definitions. The option can be chosen by the
252
person installing ESS for a site or by an individual.
202
For a site installation or an individual, uncomment ONLY ONE of the
203
following lines in your ess-site.el!
204
ESS[SAS] Function keys are available in ESS[SAS] if you
205
uncomment either 2 or 3 and in all modes if you uncomment 4 or 5:
256
For a site installation or an individual, uncomment ONLY ONE of the
257
following lines in your ess-site.el. ESS[SAS] Function keys are
258
available in ESS[SAS] if you uncomment either 2 or 3 and in all modes if
259
you uncomment 4 or 5:
207
261
;;2; (setq ess-sas-local-unix-keys t)
208
262
;;3; (setq ess-sas-local-pc-keys t)
218
272
If your site installation has configured the keys contrary to your
219
liking, say 2, you must turn it off before selecting a different
273
liking, then you must call the appropriate function.
223
(setq ess-sas-local-unix-keys nil) ;;2
224
(setq ess-sas-local-pc-keys t) ;;3
275
(load "ess-site") ;; local-unix-keys
276
(ess-sas-global-pc-keys)
228
280
Finally, we get to what the function keys actually do. You may recognize
229
some of the Short Names as SAS Display Manager commands (they
230
are in all capitals).
281
some of the nicknames as SAS Display Manager commands (they are in all
233
Unix PC Short Name Long Description
235
F2 F2 refresh revert the current buffer with the file of the
236
same name if the file is newer than the buffer
238
F3 F8 SUBMIT save the current .sas file (which is either the
239
.sas file in the current buffer or the .sas
240
file associated with the .lst or .log file in the
241
current buffer) and submit the file as a batch
244
F4 F5 PROGRAM switch buffer to .sas file
246
F5 F6 LOG switch buffer to .log file, `refresh' and goto
247
next error message, if any
249
F6 F7 OUTPUT switch buffer to .lst file and `refresh'
251
F7 F4 filetype-1 switch buffer to filetype-1 (defaults to .txt)
254
F8 F3 shell switch buffer to shell
256
F9 F9 VIEWTABLE open an interactive FSEDIT/FSBROWSE session
257
on the SAS dataset near point
259
F10 F10 toggle-log toggle ESS[SAS] for .log files; may be useful
260
for certain debugging situations
262
F11 F11 filetype-2 switch buffer to filetype-2 (defaults to .dat)
265
F12 F12 viewgraph open a GSASFILE near point for viewing either
266
in emacs or with an external viewer
268
C-F3 C-F8 submit-region write region to ess-temp.sas and submit
270
C-F5 C-F6 append-to-log append ess-temp.log to the current .log file
272
C-F6 C-F7 append-to-output append ess-temp.lst to the current .lst file
285
Unix PC Nickname "inferior" Alias (if any) and Description
288
revert the current buffer with the file of the same
289
name if the file is newer than the buffer
292
save the current .sas file (which is either the .sas
293
file in the current buffer or the .sas file associated
294
with the .lst or .log file in the current buffer) and
295
submit the file as a batch SAS job
298
switch buffer to .sas file
301
switch buffer to .log file, `refresh' and goto next
302
error message, if any
305
switch buffer to .lst file and `refresh'
308
switch buffer to filetype-1 (defaults to .txt) file
312
switch buffer to shell
315
open an interactive FSEDIT/FSBROWSE session on the SAS
319
toggle ESS[SAS] for .log files; may be useful for
320
certain debugging situations
323
switch buffer to filetype-2 (defaults to .dat) file
327
open a GSASFILE near point for viewing either in emacs
328
or with an external viewer
330
C-F1 C-F1 rtf-portrait
331
create an MS RTF portrait file from the current buffer
332
with a file extension of .rtf
334
C-F2 C-F2 rtf-landscape
335
create an MS RTF landscape file from the current buffer
336
with a file extension of .rtf
338
C-F3 C-F8 submit-region C-c C-r
339
write region to ess-temp.sas and submit
341
C-F5 C-F6 append-to-log
342
append ess-temp.log to the current .log file
344
C-F6 C-F7 append-to-output
345
append ess-temp.lst to the current .lst file
348
open an interactive INSIGHT session on the SAS
351
C-F10 C-F10 kill-em-all
352
kill all buffers associated with a .sas program
275
355
SUBMIT, PROGRAM, LOG and OUTPUT need no further explanation since
285
365
that may rely on different methods specified by the buffer-local variable
286
366
ess-sas-submit-method.
288
F2 performs the `refresh' operation on the current buffer. `refresh'
368
F2 performs the `refresh' operation on the current buffer. `refresh'
289
369
compares the buffer's last modified date/time with the file's last
290
modified date/time and replaces the buffer with the file if the file is newer.
291
This is the same operation that is automatically performed when LOG, OUTPUT,
292
`filetype-1' or `filetype-2' are pressed.
370
modified date/time and replaces the buffer with the file if the file is
371
newer. This is the same operation that is automatically performed when
372
LOG, OUTPUT, `filetype-1' or F11 are pressed.
294
`filetype-1' switches you to a file with the same file name as your .sas file,
295
but with a different extension (.txt by default) and performs `refresh'.
296
You can over-ride the default extension; for example in your .emacs file:
374
`filetype-1' switches you to a file with the same file name as your .sas
375
file, but with a different extension (.txt by default) and performs
376
`refresh'. You can over-ride the default extension; for example in your
298
379
(setq ess-sas-suffix-1 "csv") ; for example
301
F9 will prompt you for the name of a permanent SAS dataset near point to be opened
302
for viewing by PROC FSEDIT. You can control the SAS batch command-line with
303
ess-sas-data-view-submit-options. For controlling the SAS batch commands, you have
304
the global variables ess-sas-data-view-libname and ess-sas-data-view-fsview-command
305
as well as the buffer-local variable ess-sas-data-view-fsview-statement. If
306
you have your SAS LIBNAMEs defined in autoexec.sas, then the defaults for
382
F9 will prompt you for the name of a permanent SAS dataset near point to
383
be opened for viewing by PROC FSEDIT. You can control the SAS batch
384
command-line with ess-sas-data-view-submit-options. For controlling the
385
SAS batch commands, you have the global variables
386
ess-sas-data-view-libname and ess-sas-data-view-fsview-command as well
387
as the buffer-local variable ess-sas-data-view-fsview-statement. If you
388
have your SAS LIBNAMEs defined in autoexec.sas, then the defaults for
307
389
these variables should be sufficient.
309
F10 toggles ESS[SAS] mode for .log files which is off by default (technically,
310
it is SAS-log-mode, but it looks the same). The syntax highlighting can be
311
helpful in certain debugging situations, but large .log files may take a long
391
Similarly, C-F9 will prompt you for the name of a permanent SAS dataset
392
near point to be opened for viewing by PROC INSIGHT. You can control
393
the SAS batch command-line with ess-sas-data-view-submit-options. For
394
controlling the SAS batch commands, you have the global variables
395
ess-sas-data-view-libname and ess-sas-data-view-insight-command as well
396
as the buffer-local variable ess-sas-data-view-insight-statement.
398
F10 toggles ESS[SAS] mode for .log files which is off by default
399
(technically, it is SAS-log-mode, but it looks the same). The syntax
400
highlighting can be helpful in certain debugging situations, but large
401
.log files may take a long time to highlight.
314
403
F11 is the same as `filetype-1' except it is .dat by default.
316
F12 will prompt you for the name of a GSASFILE near point to be opened for viewing either with
317
emacs or with an external viewer. Depending on your version of emacs and
318
the operating system you are using, emacs may support .gif and .jpg files
319
internally. You may need to change the following two variables for your
322
(setq ess-sas-graph-suffix-regexp "[.]\\(e?ps\\|gif\\|jpe?g\\|tiff?\\)")
323
(setq ess-sas-image-viewer "kodakimg") ;; Windows external viewer
326
@comment node-name, next, previous, up
327
@node ESS(SAS)--TAB key, ESS(SAS)--Usage scenarios, ESS(SAS)--Function keys for batch processing, Help for SAS
328
@section ESS[SAS]--TAB key
330
Two options. The TAB key is bound by default to sas-indent-line. This function is
331
used to syntactically indent SAS code so PROC and RUN are in the left
332
margin, other statements are indented 4 spaces from the margin,
333
continuation lines are indented 4 spaces in from the beginning column
334
of that statement. This is the type of functionality that emacs
335
provides in most programming language modes. This functionality is
336
equivalent to uncommenting the following line in ess-site.el:
338
(setq ess-sas-edit-keys-toggle 0)
341
ESS provides an alternate behavior for the TAB key that makes it
342
behave as it does in other editors, i.e. move the cursor to the
343
next tab stop. The alternate behavior also provides a backwards TAB,
344
C-TAB, that moves the cursor to the tab stop to the left and deletes
345
any characters between them. This functionality is obtained by uncommenting the
346
following line in ess-site.el:
348
(setq ess-sas-edit-keys-toggle 1)
350
Under the alternate behavior, the TAB key is bound to tab-to-tab-stop
351
and the tab stops are set at multiples of sas-indent-width.
353
@comment node-name, next, previous, up
354
@node ESS(SAS)--Usage scenarios, iESS(SAS)--Common problems, ESS(SAS)--TAB key, Help for SAS
355
@section ESS[SAS]--Usage scenarios
357
We present one scenario for using ESS to interact with SAS (comments
358
are prefixed by "##").
360
SAS Batch (ess-sas-global-unix-keys shown with
361
ess-sas-global-pc-keys denoted by -pc- comments)
363
## Find the file you want to work with
365
## myfile.sas will be in ESS[SAS] mode
367
## Edit as appropriate, then save and submit the batch SAS job.
371
## The job runs in the shell buffer while you continue to edit
372
## myfile.sas. If ess-sas-submit-method is 'sh, then the
373
## message buffer will display the shell notification when the
374
## job is complete. The 'sh setting also allows you to
375
## terminate the SAS batch job before it is finished.
379
## Terminating a SAS batch job; typing in the *shell* buffer.
382
## You may want to visit the .log (whether the job is still running
383
## or it is finished) and check for error messages. The .log will be
384
## refreshed and you will be placed in it's buffer. You will be
385
## taken to the 1st error message after the cursor, if any.
389
## Goto the next error message, if any.
393
## Now, refresh the .lst and go to it's buffer.
397
## If you wish to make changes, go to the .sas file with
401
## Make your editing changes and submit again.
408
## Find the file you want to work with
410
## myfile.sas will be in ESS[SAS] mode
412
## Edit as appropriate, and then start up SAS with the cursor in
413
## the myfile.sas buffer
416
## Four buffers will appear on screen:
417
## myfile.sas in ESS[SAS] mode # your source file
418
## *SAS:1* in iESS [SAS:1] mode # ESS communication buffer
419
## *SAS:1.log* in Shell [] ESStr mode # SAS log information
420
## *SAS:1.lst* in Shell [] ESSlst mode # SAS listing information
422
## If you would prefer each of the four buffers to appear in its
423
## own individual frame, you can arrange for that. Place the
424
## cursor in the buffer displaying myfile.sas. Enter the
428
## The cursor will normally be in buffer myfile.sas.
429
## If not, put it there:
432
## Send regions, lines, or the entire file contents to SAS
433
## (regions are most useful). A highlighted region will normally
434
## begin with the keywords 'DATA' or 'PROC' and end with the
438
## Information appears in the log buffer, analysis results in the
439
## listing buffer. In case of errors, make the corrections in the
440
## myfile.sas buffer and resubmit with another C-c C-r
442
## PROC GPLOT graphs will normally be produced in a postscript
443
## file and be viewed later. Include the lines
444
/* required gsoptions for batch files */
445
/* comment out these lines for interactive use on X-terminals*/
446
filename grafout 'temp.ps';
447
goptions device=ps gsfname=grafout gsfmode=append gaccess=sasgastd;
450
## PROC PLOT graphs can be viewed in the listing buffer. You may
451
## wish to control the vertical spacing to allow the entire plot
452
## to be visible on screen, for example, by
453
proc plot; plot a*b / vpos=25;
455
## At the end of the session you may save the log and listing
456
## buffers with the usual C-x C-s commands. You will be prompted
457
## for a file name. Typically, the names myfile.log and mfile.lst
458
## will be used. You will almost certainly want to edit the saved
459
## files before including them in a report. The files are
460
## read-only by default. You can make them writable by the emacs
463
## At the end of the session, the input file myfile.sas will
464
## typically have been revised. You can save it. It can be used
465
## later as the beginning of another iESS[SAS] session. It can
466
## also be used as a batch input file to SAS.
468
## The *SAS:1* buffer is strictly for ESS use. The user should
469
## never need to read it or write to it. Refer to the .lst and
470
## .log buffers for monitoring output!
473
@comment node-name, next, previous, up
474
@node iESS(SAS)--Common problems, ESS(SAS)--MS Windows, ESS(SAS)--Usage scenarios, Help for SAS
405
F12 will prompt you for the name of a GSASFILE near the point in .log to
406
be opened for viewing either with emacs or with an external viewer.
407
Depending on your version of emacs and the operating system you are
408
using, emacs may support .gif and .jpg files internally. You may need
409
to change the following variables for your own situation.
410
ess-sas-graph-view-suffix-regexp is a regular expression of supported
411
file types defined via file name extensions.
412
ess-sas-graph-view-viewer-default is the default external viewer for
413
your platform. ess-sas-graph-view-viewer-alist is an alist of
414
exceptions to the default; i.e. file types and their associated
415
viewers which will be used rather than the default viewer.
417
(setq ess-sas-graph-view-suffix-regexp (concat "[.]\\([eE]?[pP][sS]\\|"
418
"[pP][dD][fF]\\|[gG][iI][fF]\\|[jJ][pP][eE]?[gG]\\|"
419
"[tT][iI][fF][fF]?\\)")) ;; default
420
(setq ess-sas-graph-view-viewer-default "kodakimg") ;; Windows default
421
(setq ess-sas-graph-view-viewer-default "sdtimage") ;; Solaris default
422
(setq ess-sas-graph-view-viewer-alist
423
'(("[eE]?[pP][sS]" . "gv") ("[pP][dD][fF]" . "acroread")) ;; default
426
C-F2 produces US landscape by default, however, it can produce A4
427
landscape (first line for "global" key mapping, second for "local"):
429
(global-set-key [(control f2)] 'ess-sas-rtf-a4-landscape)
430
(define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-a4-landscape)
434
@comment node-name, next, previous, up
435
@node iESS(SAS)--Interactive SAS processes, iESS(SAS)--Common problems, ESS(SAS)--Function keys for batch processing, ESS for SAS
436
@section iESS[SAS]--Interactive SAS processes
438
iESS (inferior ESS) is the method for interfacing with interactive
439
statistical processes (programs). iESS[SAS] is what is needed for
440
interactive SAS programming. iESS[SAS] works best
441
with the following settings for SAS command-line options
442
(the default of inferior-SAS-args):
445
-stdio -linesize 80 -noovp -nosyntaxcheck
450
required to make the redirection of stdio work
452
keeps output lines from folding on standard terminals
454
prevents error messages from printing 3 times
456
permits recovery after syntax errors
459
To start up iESS[SAS] mode, use:
464
The *SAS:1.log* buffer in ESStr mode corresponds to the file
465
myfile.log in SAS batch usage and to the "SAS: LOG" window in the SAS
466
Display Manager. All commands submitted to SAS, informative
467
messages, warnings, and errors appear here.
469
The *SAS:1.lst* buffer in ESSlst mode corresponds to the file
470
myfile.lst in SAS batch usage and to the "SAS: OUTPUT" window in the
471
SAS Display Manager. All data related printed output from the
472
PROCs appear in this window.
474
The iESS [SAS:1] buffer exists solely as a communications buffer.
475
Files are edited in the myfile.sas buffer. The C-c C-r key in
476
ESS[SAS] is the functional equivalent of bringing a file into the
477
"SAS: PROGRAM EDITOR" window followed by the 'Local' 'Submit' menu
478
commands. The user should never use this buffer directly.
480
For example, open the file you want to work with.
484
myfile.sas will be in ESS[SAS] mode. Edit as appropriate, and then start
485
up SAS with the cursor in the myfile.sas buffer.
489
Four buffers will appear on screen:
491
Buffer Mode Description
492
myfile.sas ESS[SAS] your source file
493
*SAS:1* iESS [SAS:1] ESS communication buffer
494
*SAS:1.log* Shell [] ESStr SAS log information
495
*SAS:1.lst* Shell [] ESSlst SAS listing information
497
If you would prefer each of the four buffers to appear in its
498
own individual frame, you can arrange for that. Place the
499
cursor in the buffer displaying myfile.sas. Enter the
504
The cursor will normally be in buffer myfile.sas.
505
If not, put it there:
509
Send regions, lines, or the entire file contents to SAS
510
(regions are most useful). A highlighted region will normally
511
begin with the keywords 'DATA' or 'PROC' and end with the
516
Information appears in the log buffer, analysis results in the
517
listing buffer. In case of errors, make the corrections in the
518
myfile.sas buffer and resubmit with another C-c C-r
520
At the end of the session you may save the log and listing
521
buffers with the usual C-x C-s commands. You will be prompted
522
for a file name. Typically, the names myfile.log and myfile.lst
523
will be used. You will almost certainly want to edit the saved
524
files before including them in a report. The files are
525
read-only by default. You can make them writable by the emacs
528
At the end of the session, the input file myfile.sas will
529
typically have been revised. You can save it. It can be used
530
later as the beginning of another iESS[SAS] session. It can
531
also be used as a batch input file to SAS.
533
The *SAS:1* buffer is strictly for ESS use. The user should
534
never need to read it or write to it. Refer to the .lst and
535
.log buffers for monitoring output!
537
@c DANGER Will Robinson!
540
@c - The ability to request help from a process for variables and
541
@c functions, and to have the results sent into a separate buffer.
542
@c - completion of object names and file names.
545
Troubleshooting: @xref{iESS(SAS)--Common problems}.
547
@comment node-name, next, previous, up
548
@node iESS(SAS)--Common problems, ESS(SAS)--Graphics, iESS(SAS)--Interactive SAS processes, ESS for SAS
475
549
@section iESS[SAS]--Common problems