INSERT_DATASET

Inserts a SAS data set into a package

Syntax

CALL INSERT_DATASET(packageId, libname, memname, desc, nameValue, rc
<, properties, propValue1, ...propValueN> );

Required Arguments

packageID
identifies the package.
Type:Numeric, Input
libname
names the library that contains the data set.
Type:Character, Input
memname
names the data set.
Type:Character, Input
desc
describes the data set.
Type:Character, Input
nameValue
identifies a list of one or more space-separated name/value pairs, each in one of the following forms:
  • name
  • name=value
  • name="value"
  • name="single value with spaces"
  • name=(value)
  • name=("value")
  • name=(value1, "value 2",… valueN)
Name/value pairs are site-specific; they are used for the purpose of filtering.
Type:Character, Input
rc
receives a return code.
Type:Numeric, Output

Optional Arguments

properties
identifies a comma-separated list of optional property names. Valid property names are as follows:
  • ALLOW_READ_PROTECTED_MEMBER
  • DATASET_OPTIONS
  • TRANSFORMATION_TYPE
  • CSV_SEPARATOR
  • CSV_FLAG
Type:Character, Input
propValue1, …propValueN
specifies one value for each specified property. The order of the values matches the order of the property names in the properties parameter. Valid property values are defined as follows:
ALLOW_READ_PROTECTED_MEMBER specifies a value of "YES". It is important to note that the password and encryption attributes are not preserved in the intermediate published format (whether on a queue or in an archive). Because of this exposure, take care when publishing data sets that are password protected, encrypted or both. The ALLOW_READ_PROTECTED_MEMBER property must be asserted on read-protected data sets in order to be published. This property ensures that the publisher realizes that this is a read-protected data set, and that the read password and encryption attributes are not preserved when stored in the intermediate format. If this property is not applied, then the publish operation fails when trying to publish the read-protected data set.
DATASET_OPTIONS specifies data set options. For a complete list of data set options, see the SAS Data Set Options topic in the SAS Help.
TRANSFORMATION_TYPE indicates that the data set should be transformed to the specified type when published. At this time, the only supported value for this property is CSV, for Comma-Separated-Value.
CSV_SEPARATOR indicates the separator to use when creating the CSV file. The default separator is a comma (,).
CSV_FLAG indicates a CSV override flag. Supported values include NO_VARIABLES, NO_LABELS, and EXTENDED. By default, when writing numeric variable values into the CSV file, BEST is used to format numerics that have no format associated with them. To override this default, specify the property value EXTENDED on the CSV_FLAG property. This extends the number of digits used as the precision level. By default, if the data set is transformed into a CSV file, then the file's first line contains all of the specified variables. The second line contains all of the specified labels. To override this default behavior, specify flags with values "NO_VARIABLES" or "NO_LABELS". To specify both values, a CSV_FLAG property must be specified for each.
Type:Character or Numeric, Input

Details

When the data set is published, data set attributes are cloned so that when it is retrieved back into SAS, the created data set will have similar attributes. Attributes that are cloned include encryption, passwords, data set label, data set type, indexes and integrity constraints. It is important to know that the password and encryption attributes are not preserved in the intermediate format (whether on a queue or in an archive). Because of this exposure, take care when publishing data sets that are password-protected, encrypted, or both.

Examples

Example 1: Transforming Data into a CSV File and Publishing

The following example specifies a transformation type of CSV and two CSV_FLAG properties. The data set is transformed into a CSV file and published in CSV format.
prop='TRANSFORMATION_TYPE,CSV_SEPARATOR,CSV_FLAG,CSV_FLAG';
ttype='CSV';
separator='/';
flag1 = 'NO_VARIABLES';
flag2 = 'NO_LABELS';
CALL INSERT_DATASET(packageId, libname, memname, desc,
   nameValue, rc, prop, ttype, separator, flag1, flag2);

Example 2: Publishing a SAS Data Set in a Package

The following example inserts the SAS data set FINANCE.PAYROLL into a package.
libname = 'finance';
memname = 'payroll';
desc = 'Monthly payroll data.';
nameValue='';
CALL INSERT_DATASET(packageId, libname,
   memname, desc, nameValue, rc);

Example 3: Publishing a SAS Data Set and Applying a Password

The following example uses the DATASET_OPTIONS property to apply a password for read access and to apply a subsetting WHERE statement to the data set when publishing the package. Because the data set is read-protected, you must specify the ALLOW_READ_PROTECTED_MEMBER property. Package publishing fails without this property.
libname = 'hr';
memname ='employee';
desc = 'Employee database.';
nameValue='';
properties="DATASET_OPTIONS, ALLOW_READ_PROTECTED_MEMBER";
opt="READ=abc Where=(x<10)";
allow="yes";
CALL INSERT_DATASET(packageId, libname, memname,
   desc, nameValue, rc, properties, opt, allow);

Example 4: Using INSERT_DATASET with the TRANSFORMATION_TYPE Property

The following example uses the TRANSFORMATION_TYPE property to publish a data set in CSV format.
libname = 'hr';
memname = 'employee';
desc = 'Employee database.';
nameValue='';
ttype ='CSV';
prop = "TRANSFORMATION_TYPE";
CALL INSERT_DATASET(packageId, libname, memname,
   desc, nameValue, rc, prop, ttype);