Chapter Contents |
Previous |
Next |
OPEN |
Category: | SAS File I/O |
Syntax | |
Arguments | |
Details | |
Examples | |
See Also |
Syntax |
OPEN(<data-set-name<,mode>>) |
<libref.>member-name<(data-set-options)> |
Default: | The default value for data-set-name is _LAST_. |
Restriction: | If you specify the FIRSTOBS= and OBS= data set, they are ignored. All other data set options are valid. |
I | opens the data set in INPUT mode
(default). Values can be read but not modified.
'I' uses the strongest
access mode available in the engine. That is, if the engine supports random
access, OPEN defaults to random access. Otherwise, the file is opened in
'IN' mode automatically. Files are opened with sequential access and
a system level warning is set. |
IN | opens the data set in INPUT mode. Observations are read sequentially, and you are allowed to revisit an observation. |
IS | opens the data set in INPUT mode. Observations are read sequentially, but you are not allowed to revisit an observation. |
Default: | I |
Details |
OPEN opens a SAS data set (a SAS data set or a SAS SQL view) and returns a unique numeric data set identifier, which is used in most other data set access functions. OPEN returns 0 if the data set could not be opened.
By default, a SAS data set is opened with a control level of RECORD. For details, see the data set option CNTLLEV=. An open SAS data set should be closed when it is no longer needed. If you open a data set within a DATA step, it will be closed automatically when the DATA step ends.
OPEN defaults to the strongest access mode available in the engine. That is, if the engine supports random access, OPEN defaults to random access when data sets are opened in INPUT or UPDATE mode. Otherwise, data sets are opened with sequential access, and a system-level warning is set.
Examples |
%let dsid=%sysfunc(open(master.prices,i)); %if (&dsid = 0) %then %put %sysfunc(sysmsg()); %else %put PRICES data set has been opened;
%let choice = style="RANCH"; %let dsid=%sysfunc(open(sasuser.houses (where=(&choice)),i));
See Also |
Function:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.