DATASETS Procedure

Example 3: Saving SAS Files from Deletion

Features:

SAVE statement option: : MEMTYPE=

This example uses the SAVE statement to save some SAS files from deletion and to delete other SAS files.

Program

options pagesize=40 linesize=80 nodate pageno=1 source;
LIBNAME elder 'SAS-library';
proc datasets lib=elder;
      save chronic aging clinics / memtype=data;
   run;

Program Description

Write the programming statements to the SAS log. SAS option SOURCE writes all programming statements to the log.
options pagesize=40 linesize=80 nodate pageno=1 source;
LIBNAME elder 'SAS-library';
Specify the procedure input library to process.
proc datasets lib=elder;
Save the data sets CHRONIC, AGING, and CLINICS, and delete all other SAS files (of all types) in the ELDER library. MEMTYPE=DATA is necessary because the ELDER library has a catalog named CLINICS and a data set named CLINICS.
      save chronic aging clinics / memtype=data;
   run;

SAS Log


161
162   options pagesize=40 linesize=80 nodate pageno=1 source;
163  LIBNAME elder 'c:\Documents and Settings\mydir\My
163! Documents\procdatasets\elder';
NOTE: Libref ELDER was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\Documents and Settings\mydir\My
      Documents\procdatasets\elder
164  LIBNAME green 'c:\Documents and Settings\mydir\My
164! Documents\procdatasets\green';
NOTE: Libref GREEN was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\Documents and Settings\mydir\My
      Documents\procdatasets\green
165  proc copy in=green out=elder;

NOTE: Copying GREEN.AGING to ELDER.AGING (memtype=DATA).
NOTE: There were 1 observations read from the data set GREEN.AGING.
NOTE: The data set ELDER.AGING has 1 observations and 2 variables.
NOTE: Copying GREEN.ALCOHOL to ELDER.ALCOHOL (memtype=DATA).
NOTE: There were 1 observations read from the data set GREEN.ALCOHOL.
NOTE: The data set ELDER.ALCOHOL has 1 observations and 2 variables.
NOTE: Copying GREEN.BACKPAIN to ELDER.BACKPAIN (memtype=DATA).
NOTE: There were 1 observations read from the data set GREEN.BACKPAIN.
NOTE: The data set ELDER.BACKPAIN has 1 observations and 2 variables.
NOTE: Copying GREEN.CHRONIC to ELDER.CHRONIC (memtype=DATA).
NOTE: There were 1 observations read from the data set GREEN.CHRONIC.
NOTE: The data set ELDER.CHRONIC has 1 observations and 2 variables.
NOTE: Copying GREEN.CLINICS to ELDER.CLINICS (memtype=CATALOG).
NOTE: Copying GREEN.CLINICS to ELDER.CLINICS (memtype=DATA).
NOTE: There were 1 observations read from the data set GREEN.CLINICS.
NOTE: The data set ELDER.CLINICS has 1 observations and 2 variables.
NOTE: Copying GREEN.DISEASE to ELDER.DISEASE (memtype=DATA).
NOTE: There were 1 observations read from the data set GREEN.DISEASE.
NOTE: The data set ELDER.DISEASE has 1 observations and 2 variables.
NOTE: Copying GREEN.GROWTH to ELDER.GROWTH (memtype=DATA).
NOTE: There were 1 observations read from the data set GREEN.GROWTH.
NOTE: The data set ELDER.GROWTH has 1 observations and 2 variables.
NOTE: Copying GREEN.HOSPITAL to ELDER.HOSPITAL (memtype=CATALOG).
NOTE: PROCEDURE COPY used (Total process time):
      real time           2.42 seconds
      cpu time            0.04 seconds


166  proc datasets lib=elder;
                                   Directory

Libref         ELDER
Engine         V9
Physical Name  \myfiles\elder
Filename       \myfiles\elder


                        Member     File
           #  Name      Type       Size  Last Modified

           1  AGING     DATA       5120  12Sep07:15:52:52
           2  ALCOHOL   DATA       5120  12Sep07:15:52:52
           3  BACKPAIN  DATA       5120  12Sep07:15:52:53
           4  CHRONIC   DATA       5120  12Sep07:15:52:53
           5  CLINICS   CATALOG   17408  12Sep07:15:52:53
           6  CLINICS   DATA       5120  12Sep07:15:52:53
           7  DISEASE   DATA       5120  12Sep07:15:52:54
           8  GROWTH    DATA       5120  12Sep07:15:52:54
           9  HOSPITAL  CATALOG   17408  12Sep07:15:52:54
 

167  save chronic aging clinics / memtype=data;
168  run;

NOTE: Saving ELDER.CHRONIC (memtype=DATA).
NOTE: Saving ELDER.AGING (memtype=DATA).
NOTE: Saving ELDER.CLINICS (memtype=DATA).
NOTE: Deleting ELDER.ALCOHOL (memtype=DATA).
NOTE: Deleting ELDER.BACKPAIN (memtype=DATA).
NOTE: Deleting ELDER.CLINICS (memtype=CATALOG).
NOTE: Deleting ELDER.DISEASE (memtype=DATA).
NOTE: Deleting ELDER.GROWTH (memtype=DATA).
NOTE: Deleting ELDER.HOSPITAL (memtype=CATALOG).