Return to Archive

SAS Tip of the Month
February 2005

I recently had a client come to me and say that a program that was being run was producing the same results in a permanent dataset despite the fact that both the data and the program had changed. In the end it was an error in the SAS program and because the error was before the time when the permanent dataset was being created, SAS stopped processing and the new dataset was not being created - the old dataset still existed.

To make sure that your program is actually creating a new permanent dataset it is useful to either delete, or sometimes create a backup copy, of the dataset at the beginning of the program. This useful as if the new expected permanent dataset does not exist after the program run then an error of some kind occurred. To delete or rename a SAS dataset, use the DATASETS procedure, using the following syntax:

    PROC DATASETS LIBRARY=library_name;
        DELETE SAS-file;  ** Delete a dataset;
        RENAME old-name=new-name;  ** Rename a dataset;
        QUIT;
    RUN;

As an example, the dataset DEMO will be deleted from the library NEW:

    PROC DATASETS LIBRARY=new;
        DELETE demo;
        QUIT;
    RUN;

The other note I would like to remind ALL SAS programmers, ALWAYS check the SAS Log file, especially for any ERROR and WARNING messages.

________________________________
Updated February 11, 2005