![]() Chapter Contents |
![]() Previous |
![]() Next |
| PREVIEW |
| Category: | Submit Block |
| Syntax | |
| Actions for the PREVIEW Function | |
| Details | |
| Example | |
| See Also |
Syntax |
| rc=PREVIEW(action<,argument-1<,argument-2<,argument-3>>>); |
| 0 | The operation was successful. |
| -1 | For actions that open the PREVIEW window, the CANCEL command was used to exit the PREVIEW window. For other actions, the requested operation was not performed successfully. |
Type: Numeric
Type: Character
Type: Character
| Actions for the PREVIEW Function |
'BROWSE''CLEAR''CLOSE''COPY'Note: If you copy an SCL entry to the PREVIEWwindow,
you should CLEAR the window before closing it. Otherwise, the SCL code that
was copied will be submitted to
SAS. ![[cautionend]](../common/images/cautend.gif)
'DISPLAY|EDIT'You can optionally specify a window title as argument-1.
'FILE'You can specify APPEND for argument-2 to append the contents of the preview buffer to the contents of the external file.
'HISTORY'
Once a history destination is set, it remains in effect for the application until a reset is performed. To clear the destination, invoke PREVIEW again by passing the HISTORY action without any subsequent argument. The application stops appending the submitted statements to the previously specified SOURCE entry.
You can also optionally specify a description of up to 40 characters for the entry as argument-2.
'INCLUDE''LINES''MODIFIED''OPEN'This window is displayed until the application closes or until you use the PREVIEW function and specify the CLOSE action. Thus, specifying OPEN enables you to keep the window open throughout an application by allowing control to return to the procedure while the window is open. With OPEN, you can optionally specify a window title as argument-1.
'PRINT'
A
to append the output to the print file. If this argument is blank or missing,
each new PRINT option replaces the contents of the print file.
'SAVE'
You can also optionally specify a description for the entry as argument-2. The first 256 characters of the description are saved.
You can also optionally specify APPEND as argument-3 to append the
contents of the PREVIEW window to the specified catalog entry.
| Details |
The preview buffer is where statements that are generated by SUBMIT blocks are stored before they are submitted for execution.
| Example |
Manipulate the PREVIEW window. The user enters values in text entry controls TABLENAME (the name of a SAS table to be created), MIMIC (the name of an existing SAS table after which the new table is modeled), and FNAME (the fileref of a file in which submitted SAS statements will be stored). If the user does not issue a CANCEL command from the application window, then PREVIEW displays the statements in the PREVIEW window. If the user does not issue a CANCEL command from the PREVIEW window, then the statements are submitted for execution. If a user issues a CANCEL command from the application or from the PREVIEW window, the PREVIEW window is cleared of all statements. When a user presses the RUN button, the statements are submitted.
INIT:
control label;
return;
RUN:
submit;
data &tablename;
set &mimic;
run;
endsubmit;
if (_status_ ne 'C') then
do;
if (preview('EDIT') = -1) then
rc=preview('clear');
else
do;
rc=preview('FILE',FNAME);
submit continue;
endsubmit;
end;
end;
else
rc=preview('clear');
return;
| See Also |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.