Contents Publish Package Interface Previous Next

RETRIEVE_DATASET

This CALL routine retrieves a data set entry from a package.

Syntax

CALL RETRIEVE_DATASET(entryId, libname, memname, rc
<, properties, propValue1, ...propValueN>);

entryId
Numeric, input.
Identifies the data set entry.

libname
Character, input.
Specifies the SAS library that will contain the retrieved data set.

memname
Character, input
Names the retrieved data set.

rc
Numeric, output.
Receives a return code.

properties
Character, input.
Identifies a comma-separated list of optional property names. Valid property names are as follows:
  • DATASET_OPTIONS
  • CSV_SEPARATOR
  • CSV_FLAG

propValue1, ...propValueN
Character, input.
Specifies one value for each specified property name. The order of the property values must match the order of the property names in the properties parameter. Valid property values are defined as follows:

DATASET_OPTIONS
Character parameter SAS data set options that are to be applied to the retrieved data set. For a complete list of data set options, see the SAS Data Set Options topic in the SAS Online Help, Release 8.2.

CSV_SEPARATOR
Character property applies only when the RETRIEVE_DATASET CALL routine is called on a CSV file entry. When this occurs, the CSV file is transformed into a SAS data set. A binary CSV file is identified by a MIME type of application/x-comma-separated-values. Use the CSV_SEPARATOR property to indicate the separator to be used when creating the CSV file. The default separator is a comma. If the CSV file was created at publish time by transforming a SAS data set into a CSV file, the separator used to create the CSV file will always take precedence. If the CSV file was not created at publish time, the CSV_SEPARATOR property may be used to specify the separator value used. If the CSV file was not created at publish time and no separator property is specified, the separator is specified as a comma, by default.

CSV_FLAG
Character property only applies when calling the RETRIEVE_DATASET CALL routine for a binary file entry. A binary CSV file is identified by a MIME type of application/x-comma-separated-values. This property is a CSV override flag. By default when converting this binary CSV file into a SAS data set, the first line will be processed as variable names. The second line will be processed as variable label names. All remaining lines will be processed as data. To override this default behavior, the CSV_FLAG value must be NO_VARIABLES or NO_LABELS. To specify both values, specify two CSV_FLAG properties, one with a value of NO_VARIABLES, the other with a value of NO_LABELS.

By default, when a CSV file is converted into a data set, the variable lengths are determined by the first row of data. If subsequent rows have greater lengths, the variable data is truncated. To override this default behavior, specify the CSV_FLAG with a property of NO_TRUNCATION. When this flag value is specified, truncation will not occur, but multiple passes of the data may be necessary in order to perform the resizing.

Details

If the MEMNAME parameter is blank, the RETRIEVE_DATASET CALL routine creates the data set using the original member name as it was defined at publish time.

The following example retrieves the data set WORK.OUTDATA entry from the package.

lib = 'work';
mem = 'outdata';
CALL RETRIEVE_DATASET(rid, lib, mem, rc);

The following example specifies two CSV_FLAG properties.

prop='CSV_SEPARATOR,CSV_FLAG,CSV_FLAG';
separator='/';
flag1 = 'NO_VARIABLES';
flag2 = 'NO_LABELS';
CALL RETRIEVE_DATASET(entryId, libname, memname, rc, prop,
                      separator, flag1, flag2);

Contents Publish Package Interface Previous Next