Listing a Directory with the DATASETS Statement

Overview

This example produces a directory listing of a CDISC ODM XML document in the SAS log. The output lists the name of the CDISC ODM SAS data set that is in the XML document named AE.XML. The output also lists the attributes of the XML document, such as ODM version and date of creation.
The example includes two different programs that illustrate how the ODM statement LONGNAMES= processing option determines the sources of captured SAS name parameters based on the value of the LONGNAMES= option.
To view the AE.XML document, see Sample CDISC ODM XML Document.

Program with LONGNAMES=NO

The following SAS program produces a directory listing using the ODM statement LONGNAMES=NO processing option:
  1. The FILENAME statement assigns the file reference Xmlinp to the physical location of the input XML document (complete pathname, filename, and file extension) to be imported.
  2. The PROC CDISC statement specifies the following:
    • CDISC ODM as the model.
    • File reference Xmlinp, which references the physical location of the input XML document to be imported.
  3. The ODM statement specifies CDISC ODM version 1.2 and the LONGNAMES=NO processing option, which determines the following:
    • ODM name attributes are converted to SAS names. Names can be a maximum of eight characters in length.
    • The SAS data set name is captured from the SASDatasetName= attribute in the ODM ItemGroupDef element.
  4. The DATASETS statement produces a directory listing of the XML document in the SAS log.
filename Xmlinp 'C:\XML\AE.xml'; 1

proc cdisc model=odm read=Xmlinp; 2
   odm odmversion="1.2" longnames=no; 3 
   datasets; 4
run;
Directory Listing of the AE.XML Document in the SAS Log
                                   Directory of CDISC ODM Tables

Libref                XMLINP
ODM Version           1.2
AsOfDateTime          2005-05-18T14:01:41
CreationDateTime      2005-05-18T14:01:41
SourceSystem          SAS 9.1
SourceSystemVersion   9.01.01M3D05172005

                                #  Tablename

                                  1  AE

Program with LONGNAMES=YES

The following SAS program produces a directory listing using the ODM statement LONGNAMES=YES processing option:
  1. The FILENAME statement assigns the file reference Xmlinp to the physical location of the input XML document (complete pathname, filename, and file extension) to be imported.
  2. The PROC CDISC statement specifies the following:
    • CDISC ODM as the model.
    • File reference Xmlinp, which references the physical location of the input XML document to be imported.
  3. The ODM statement specifies CDISC ODM version 1.2 and the LONGNAMES=YES processing option, which determines the following:
    • ODM name attributes are converted to SAS names. Names can be a maximum of 32 characters in length.
    • The SAS data set name is captured from the Name= attribute in the ODM ItemGroupDef element.
  4. The DATASETS statement produces a directory listing of the XML document in the SAS log.
filename Xmlinp 'C:\XML\AE.xml'; 1

proc cdisc model=odm read=Xmlinp; 2
   odm odmversion="1.2" longnames=yes; 3
   datasets; 4
run;
Directory Listing of the AE.XML Document in the SAS Log
                                   Directory of CDISC ODM Tables

Libref                XMLINP
ODM Version           1.2
AsOfDateTime          2005-05-18T14:01:41
CreationDateTime      2005-05-18T14:01:41
SourceSystem          SAS 9.1
SourceSystemVersion   9.01.01M3D05172005

                                #  Tablename

                                  1  Adverse_Events