Chapter 15: The DATASETS Procedure


Overview: DATASETS Procedure

What Does the DATASETS Procedure Do?

The DATASETS procedure is a utility procedure that manages your SAS files. With PROC DATASETS, you can

  • copy SAS files from one SAS library to another

  • rename SAS files

  • repair SAS files

  • delete SAS files

  • list the SAS files that are contained in a SAS library

  • list the attributes of a SAS data set, such as the date when the data was last modified, whether the data is compressed, whether the data is indexed, and so on

  • manipulate passwords on SAS files

  • append SAS data sets

  • modify attributes of SAS data sets and variables within the data sets

  • create and delete indexes on SAS data sets

  • create and manage audit files for SAS data sets

  • create and delete integrity constraints on SAS data sets.

Sample PROC DATASETS Output

The following DATASETS procedure

  1. copies all data sets from the CONTROL library to the HEALTH library

  2. lists the contents of the HEALTH library

  3. deletes the SYNDROME data set from the HEALTH library

  4. changes the name of the PRENAT data set to INFANT .

The SAS log is shown in Output 15.1.

Output 15.1: Log from PROC DATASETS
start example
 59   proc datasets library=health memtype=data details;                                                            Directory                                        Libref         HEALTH                                        Engine         V9                                        Physical Name  external-file  File Name  external-file  Member  Obs, Entries                                 File                   # Name       Type     or Indexes   Vars  Label                    Size  Last Modified                   1 ALL        DATA         23        17                           13312  29JAN2002:08:06:46                   2 BODYFAT    DATA          1         2                            5120  29JAN2002:08:06:46                   3 CONFOUND   DATA          8         4                            5120  29JAN2002:08:06:46                   4 CORONARY   DATA         39         4                            5120  29JAN2002:08:06:46                   5 DRUG1      DATA          6         2   JAN95 Data               5120  29JAN2002:08:06:46                   6 DRUG2      DATA         13         2   MAY95 Data               5120  29JAN2002:08:06:46                   7 DRUG3      DATA         11         2   JUL95 Data               5120  29JAN2002:08:06:46                   8 DRUG4      DATA          7         2   JAN92 Data               5120  29JAN2002:08:06:46                   9 DRUG5      DATA          1         2   JUL92 Data               5120  29JAN2002:08:06:46                  10 GROUP      DATA        148        11                           25600  29JAN2002:08:06:46                  11 MLSCL      DATA         32         4   Multiple Sclerosis Data  5120  29JAN2002:08:06:46                  12 NAMES      DATA          7         4                            5120  29JAN2002:08:06:46                  13 OXYGEN     DATA         31         7                            9216  29JAN2002:08:06:46                  14 PERSONL    DATA        148        11                           25600  29JAN2002:08:06:46                  15 PHARM      DATA          6         3   Sugar Study              5120  29JAN2002:08:06:46                  16 POINTS     DATA          6         6                            5120  29JAN2002:08:06:46                  17 PRENAT     DATA        149         6                           17408  29JAN2002:08:06:46                  18 RESULTS    DATA         10         5                            5120  29JAN2002:08:06:46                  19 SLEEP      DATA        108         6                            9216  29JAN2002:08:06:46                  20 SYNDROME   DATA         46         8                            9216  29JAN2002:08:06:46                  21 TENSION    DATA          4         3                            5120  29JAN2002:08:06:46                  22 TEST2      DATA         15         5                            5120  29JAN2002:08:06:46                  23 TRAIN      DATA          7         2                            5120  29JAN2002:08:06:47                  24 VISION     DATA         16         3                            5120  29JAN2002:08:06:47                  25 WEIGHT     DATA         83        13   California Results      13312  29JAN2002:08:06:47                  26 WGHT       DATA         83        13   California Results      13312  29JAN2002:08:06:47  60      delete syndrome;  61      change prenat=infant;  62   run;  NOTE: Deleting HEALTH.SYNDROME (memtype=DATA).  NOTE: Changing the name HEALTH.PRENAT to HEALTH.INFANT (memtype=DATA).  63   quit; 
end example
 
 libname control '  SAS-data-library-1  ';  libname health '  SAS-data-library-2  ';  proc datasets memtype=data;     copy in=control out=health;  run;  proc datasets library=health memtype=data details;     delete syndrome;     change prenat=infant;  run;  quit; 

Notes

  • Although the DATASETS procedure can perform some operations on catalogs, generally the CATALOG procedure is the best utility to use for managing catalogs. For documentation of PROC CATALOG, see Overview: CATALOG Procedure on page 153.

  • The term member often appears as a synonym for SAS file . If you are unfamiliar with SAS files and SAS libraries, refer to SAS Files Concepts in SAS Language Reference: Concepts .

  • PROC DATASETS cannot work with sequential data libraries.




Base SAS 9.1.3 Procedures Guide (Vol. 1)
Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4
ISBN: 1590472047
EAN: 2147483647
Year: 2004
Pages: 260

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net