SAS 9.1.3 Integration Technologies » Developer's Guide


Publish Package Interface
Publish/Retrieve Encoding Behavior
Publishing Packages
INSERT_CATALOG
INSERT_DATASET
INSERT_FDB
INSERT_FILE
INSERT_HTML
INSERT_MDDB
INSERT_PACKAGE
INSERT_REF
INSERT_SQLVIEW
INSERT_VIEWER
PACKAGE_BEGIN
PACKAGE_END
PACKAGE_PUBLISH
LDAP Channel Store Syntax
SAS Metadata Repository Channel Store Syntax
Retrieving Packages
COMPANION_NEXT
ENTRY_FIRST
ENTRY_NEXT
PACKAGE_DESTROY
PACKAGE_FIRST
PACKAGE_NEXT
PACKAGE_TERM
RETRIEVE_CATALOG
RETRIEVE_DATASET
RETRIEVE_FDB
RETRIEVE_FILE
RETRIEVE_HTML
RETRIEVE_MDDB
RETRIEVE_NESTED
RETRIEVE_PACKAGE
RETRIEVE_REF
RETRIEVE_SQLVIEW
RETRIEVE_VIEWER
Filtering Packages
Publishing Examples
Publishing in the Data Step
Publishing in a Macro
Publishing with FTP
Publishing Framework

INSERT_DATASET

Inserts a SAS data set into a package.

Syntax

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

packageID
Numeric, input.
Identifies the package.

libname
Character, input.
Names the library that contains the data set.

memname
Character, input.
Names the data set.

desc
Character, input.
Describes the data set.

nameValue
Character, input.
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.

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:
  • ALLOW_READ_PROTECTED_MEMBER
  • DATASET_OPTIONS
  • TRANSFORMATION_TYPE
  • CSV_SEPARATOR
  • CSV_FLAG

propValue1, ...propValueN
Character/numeric, input.
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
Character string with 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 datasets that are password protected and/or encrypted.

The ALLOW_READ_PROTECTED_MEMBER property must be asserted on read-protected data sets in order to be published. This ensures that the publisher realizes that this is a read-protected data set, and that the read password and encryption attributes will not be preserved when stored in the intermediate format. If this property is not applied, the publish operation will fail when trying to publish the read-protected data set.

DATASET_OPTIONS
Character string specifies data set options. For a complete list of data set options, see the SAS Data Set Options topic in the SAS Online Help, Release 8.2.

TRANSFORMATION_TYPE
Character string 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
Character parameter indicates the separator to use when creating the CSV file. The default separator is a comma (,).

CSV_FLAG
character string 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 will extend the number of digits used as the precision level.

By default, if the data set is transformed into a CSV file, the file's first line will contain all of the specified variables. The second line will contain 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.

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 and/or encrypted.

Examples

The following example specifies a transformation type of CSV and two CSV_FLAG properties. The data set will be 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);

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);

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);

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);

See Also