The FETCH statement is used to retrieve rows from an in-memory table. You can use the FETCH statement to retrieve calculated columns that are calculated according to a script as part of the request. The columns that are calculated this way do not persist beyond the time it takes to execute in the server.
specifies the starting element of an array when the record of an in-memory table represents a variable array. This is the case, for example, when a pricing cube from SAS High-Performance Risk is loaded into a server. There might then be 10,000 columns for a variable. Specifying the ARRAYSTART= and ARRAYLENGTH= options enables you to page through the data more conveniently.
specifies the length of the array to fetched when the record of an in-memory table represents a variable array. Use this option with the ARRAYSTART= option.
specifies which variables of the ORDERBY= list are used with descending sort order. Specifying the DESCENDING= option by itself has no effect. The option is specified in addition to the ORDERBY= option. The following example specifies to fetch data on columns A and B of the active table ordered by ascending unformatted values of B and descending unformatted values of C.
Alias | DESC= |
Example | fetch a b / orderby=(b c) descending=c; |
specifies the formats to use for the variables. By default, the FETCH statement retrieves the unformatted values. If you specify the FORMAT option without a list of format names, then the server applies the default format that is associated with each variable.
Alias | FORMATS= |
Example | fetch a b / formats=("", "$10"); |
specifies the index of the first row to retrieve (inclusive). The value for first-index is 1-based.
Default | FROM=1 |
Interaction | The value for FROM= is applied after the evaluation of a WHERE clause. |
prevents the procedure from pre-parsing and pre-generating code for temporary expressions, scoring programs, and other user-written SAS statements.
Alias | NOPREP |
specifies one or more variables by which to order the results. The default sort order of the ORDERBY= variables is ascending in unformatted values and follows location and collation rules. If you want to arrange some ORDERBY= variables in descending sort order, then list the variable names in the DESCENDING= option (in addition to listing them in the ORDERBY= option).
specifies the formats
to use for sorting of the ORDERBY= variables. By default, if you specify
an ORDERBY= variable or variable list, the server sorts by the ascending
unformatted values. If you want to apply unformatted value ordering
for some ORDERBY= variables, and formatted value ordering for other
ORDERBY= variables, you can specify the keyword _RAW_
for
the variables to sort by unformatted value.
Example | fetch make model type invoice mpg_city / orderby=(type invoice) desc =invoice orderbyformat=("$", "_RAW_"); |
specifies the name of the data set to store the result set of the FETCH statement.
saves the result table so that you can use it in other IMSTAT procedure statements like STORE, REPLAY, and FREE. The value for table-name must be unique within the scope of the procedure execution. The name of a table that has been freed with the FREE statement can be used again in subsequent SAVE= options.
requests that the server estimate the size of the result set. The procedure does not create a result table if the SETSIZE option is specified. Instead, the procedure reports the number of rows that are returned by the request and the expected memory consumption for the result set (in KB). If you specify the SETSIZE option, the SAS log includes the number of observations and the estimated result set size. See the following log sample:
NOTE: The LASR Analytic Server action request for the STATEMENT
statement would return 17 rows and approximately
3.641 kBytes of data.
specifies either a quoted string that contains the SAS expression that defines the temporary variables or a file reference to an external file with the SAS statements.
Alias | TE= |
specifies the list of temporary variables for the request. Each temporary variable must be defined through SAS statements that you supply with the TEMPEXPRESS= option.
Alias | TN= |
specifies the index of the last row to retrieve (inclusive). The value for last-index is 1-based.
Default | The default value is FROM=first-index + 19. |
Interaction | The value for TO= is applied after the evaluation of a WHERE clause. |