SAS P1 L3b Flashcards
Four characteristics of user-created library?
User-created library is:
- Permanent
- Implemented within operating system file system.
- NOT automatically available in SAS session.
- must assign libref to user created library to make it available in SAS session.
How define library?
Syntax?
To define library, use LIBNAME to associated libref with physical location. Makes data available during current session.
Syntax: LIBNAME libref ‘SAS-library’
LIBNAME = key word
Rules for libref names?
length?
begin with?
use?
Rules for libref names:
- length: 1 to 8 characters
- must begin with letter or underscore
- must use (contain) letters, underscore, or numbers
Location for libref?
Libref location must reference an existing folder.
Enclose physical location in single or double quotes.
[LIBNAME doesn’t create new folder]
What is LIBNAME? type of statement? need run? need be with other? how many can you have?
LIBNAME:
- is a GLOBAL statement
- does NOT need run statement
- can be submitted alone or store with other SAS programs
- can use more than one LIBNAME statement/program
(for different libraries)
How do you browse library via a program?
Syntax?
Key words?
How to browse library via program:
PROC CONTENTS statement
PROC CONTENTS DATA=libref.ALL;
RUN;
this will display list of all SAS files in SAS library
Keywords: PROC, CONTENTS, ALL
When browsing library, how omit descriptor portion?
Add “nods” to end of ALL
leave space after underscore
What does CONTENTS produce? (3 things)
order?
CONTENTS produces (shows) the following:
- directory
- listing of members of library and member type (in alpha order )
- information about each individual data set in library = descriptor portion
- if don’t need descriptor portion, use “nods”
What does PROC PRINT do?
Syntax?
PROC PRINT
accesses permanent data set
PROC PRINT DATA=SAS-DATA-SET;
RUN;
How cancel libref?
Syntax?
Must use CLEAR statement to cancel libref.
(will dissociate library)
Otherwise stays in effect until session ends.
LIBNAME libref CLEAR;