Viewing SAS Libraries

Viewing Libraries

Besides accessing library details with librefs, you can also see libraries in other environments. You can access a brief overview on the windows and menus for your environment at http://video.sas.com/. From Categories select How To Tutorials>Programming. Select the video for your SAS environment. Other tutorials are available from the SAS website.

Viewing Libraries Using PROC CONTENTS

You can use the CONTENTS procedure to create SAS output that describes either of the following:
  • the contents of a library
  • the descriptor information for an individual SAS data set
The default library is either Work or User depending on your SAS solution or environment.
Syntax, PROC CONTENTS step:
PROC CONTENTS DATA=SAS-file-specification NODS;
RUN;
  • SAS-file-specification specifies an entire library or a specific SAS data set within a library. SAS-file-specification can take one of the following forms:
    • <libref.>SAS-data-set names one SAS data set to process.
    • <libref.>_ALL_ requests a listing of all files in the library. (Use a period (.) to append _ALL_ to the libref.)
  • NODS suppresses the printing of detailed information about each file when you specify _ALL_. (You can specify NODS only when you specify _ALL_.)

Example: View the Contents of an Entire Library

To view the contents of an entire library, specify the _ALL_ and NODS options in the PROC CONTENTS step. The _ALL_ option lists all files in the Cert library, and the NODS option suppresses the printing of detailed information about each specific file.
proc contents data=cert._all_ nods;
run;
The following output displays a partial output of the contents of the Cert library. The _ALL_ option lists all files including indexes, views, and catalogs.
Output 3.1 PROC CONTENTS Output: the SAS Library Cert (partial output)
Partial Output from PROC CONTENTS on SAS Library Cert

Example: View Descriptor Information

To view the descriptor information for only a specific data set, use the PROC CONTENTS step. The following example lists the descriptor information for Cert.Amounts including an alphabetic list of the variables in the data set.
proc contents data=cert.amounts;
run;
The following output is the result from submitting the PROC CONTENTS step.
Output 3.2 PROC CONTENTS Output
PROC CONTENTS Output: Descriptor Information
PROC CONTENTS Output Showing the Engine/Host Dependent Information for a Single Data Set in a Library
PROC CONTENTS Output Showing an Alphabetic List of the Variables in the Data Set

Example: View Descriptor Information Using the Varnum Option

By default, PROC CONTENTS lists variables alphabetically. To list variable names in the order of their logical position (or creation order) in the data set, specify the VARNUM option in PROC CONTENTS.
proc contents data=cert.amounts varnum;
run;
Output 3.3 View Descriptor Information for Cert.Amounts Using the VARNUM Option
View Descriptor Information for Cert.Amounts Using the VARNUM Option
Last updated: August 23, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.96.214