Chapter Contents

Previous

Next
SAS Companion for the CMS Environment

Managing Your CMS SAS Files and Libraries

SAS provides the CONTENTS, COPY, and DATASETS procedures to facilitate the management of SAS data libraries and files. Host-specific aspects of these procedures are described in Procedures in the CMS Environment. For complete discussions of these and other SAS utility procedures, see SAS Procedures Guide. The SAS procedures are described briefly in this section and are compared to the CMS commands that perform similar functions.


Listing SAS Files

Both the CONTENTS procedure and the CONTENTS statement in the DATASETS procedure can list all SAS files in a SAS library. The CONTENTS procedure can also retrieve the descriptor information at the beginning of a SAS data set.

To compare the file information that is generated by the CMS FILELIST command with the information that is generated by PROC CONTENTS, see Sample Output from the CMS FILELIST Command and Sample Output from the CONTENTS Procedure. Output 4.1 on page 34 illustrates the file information that is displayed by issuing the following CMS FILELIST command

filelist * mylib a

This command, issued in CMS subset mode, requests a listing of all files on the A disk that have the filetype MYLIB.

Sample Output from the CMS FILELIST Command
  USER1   FILELIST A0  V 108 Trunc=108 Size=3 Line=1 Col=1 Alt=0
 Cmd  Filename Filetype Fm Format Lrecl Records Blocks   Date   Time
      3RANCH   MYLIB    A1 F       1024       3      1 06/01/99  8:39:55  
      0HSCREEN MYLIB    A1 F       1024      13      3 06/01/99 16:47:25
      HOUSES   MYLIB    A1 F       1024       3      1 06/01/99 16:47:20


 1=Help      2=Refresh 3=Quit   4=Sort(type)  5=Sort(date)  6=Sort(size)
 7= Backward 8=Forward 9=FL /n 10=           11=XEDIT/LIST 12=Cursor  

 ====>                                               X E D I T  1 File

Sample Output from the CONTENTS Procedure shows the directory information that is retrieved by PROC CONTENTS for the same group of files. The following SAS statement lists all data sets in the SAS data library MYLIB. NODS specifies that no data set descriptor information be printed. The DIRECTORY option is assumed by default.

proc contents data=mylib._all_ nods;

Sample Output from the CONTENTS Procedure
                                The SAS System                              3
                                            08:31 Monday, June 1, 1999
  
                              CONTENTS PROCEDURE
  
                             -----Directory-----
  
                          Libref:        MYLIB
                          Engine:        V8
                          Physical Name: MYLIB    A1
  
                         #  Name     Memtype  File  Last Modified
                                              Size
                         ----------------------------------------
 
                         1  HOUSES   DATA      9     01Jun1999:16:47:20      
                         2  HSCREEN  CATALOG   9     01Jun1999:16:47:25      
                         3  RANCH    VIEW      9     01Jun1999:08:39:55      

Compare the CMS filenames that are listed by the CMS FILELIST command with the SAS filenames that are listed by the CONTENTS procedure. For example, look at the information for SAS file RANCH in Sample Output from the CONTENTS Procedure . You see that its memtype is VIEW. Now look at the information in Sample Output from the CMS FILELIST Command . You see an entry for a CMS file with a filename of 3RANCH. CMS recognizes the SAS file RANCH as 3RANCH because SAS added the prefix 3 to the filename so that it could recognize the file's SAS filetype. (See SAS Filename Restrictions for more information about prefix characters.)

When you use SAS utilities to manage your SAS files, you do not need to be concerned about the prefix. But when you use CMS commands, you must use the prefix.


Copying SAS Files

The best ways to copy SAS files are with the SAS COPY procedure or with the COPY statement of the DATASETS procedure. However, sometimes it is possible to use CMS commands. CMS commands cannot convert SAS files to and from tape format; they cannot read DDnames that begin with TAPE. But you can use CMS commands to copy SAS files in the following ways:

If you use a CMS command, remember to include any prefix characters in the CMS filename. (See SAS Filename Restrictions for information about prefix characters.) For example, to copy the SAS data view PROJCTS MONTHLY into another SAS data view using the CMS COPYFILE command, you can issue the following command:

copy 3projcts monthly a 3rhouse monthly b

When you use the CMS COPYFILE command to copy a SAS data set that has an index file associated with it, be sure to copy the index file as well.


Deleting SAS Files

The SAS DATASETS procedure deletes and renames disk-format SAS files. You can also use the CMS ERASE command to delete some or all members of a SAS data library. For example, suppose you create a catalog called MYLIB.DATASCR (CMS file 0DATASCR MYLIB) that contains FSEDIT screens as entries. In a PROC FSEDIT statement you specify the SAS name for the file, which is the CMS filename without the prefix 0. For example, you can issue the following statement:

proc fsedit data=mylib.houses screen=mylib.hscreen;

But if you want to use the CMS ERASE command, specify the CMS filename 0HSCREEN, as in the following example:

ERASE 0HSCREEN MYLIB A

(See SAS Filename Restrictions for more information about prefix characters.)


Renaming SAS Files

You can rename a disk-format SAS file with the CHANGE, EXCHANGE, and AGE statements in the DATASETS procedure or with the CMS RENAME command. If you use the RENAME command, remember to include any prefix characters in the filename.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.