[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: OT: Chance to Make SAS-L History: Did You Know That...
From: Paul St Louis <pstloui () DOT ! STATE ! TX ! US>
Date: 2009-03-31 20:18:05
Message-ID: 200903312018.n2VAkjls031904 () malibu ! cc ! uga ! edu
[Download RAW message or body]
...you can use Proc Datasets to delete multiple datasets with common
letters or numbers in their names? Since there isn't an _all_ option
available (and I feel very nervous about the kill option), this is an
alternate approach to removing several datasets all at once.
For instance, I have a program that reads multiple text files from the web
and compares them line by line to export files generated by a certain
program. This process creates several datasets, each beginning with the
phrase CDA or WEB. After the report is complete, I can clean up these
files as follows:
PROC SQL NOPRINT;
SELECT MEMNAME
INTO :CDA_DEL_LIST SEPARATED BY " "
FROM DICTIONARY.MEMBERS
WHERE COMPRESS(LIBNAME) LIKE 'WORK' AND
UPCASE(SUBSTR(MEMNAME,1,3)) LIKE 'CDA' AND
UPCASE(SUBSTR(MEMNAME,4,4)) NE 'DONE';
QUIT;
PROC SQL NOPRINT;
SELECT MEMNAME
INTO :WEB_DEL_LIST SEPARATED BY " "
FROM DICTIONARY.MEMBERS
WHERE COMPRESS(LIBNAME) LIKE 'WORK' AND
UPCASE(SUBSTR(MEMNAME,1,3)) LIKE 'WEB' AND
UPCASE(SUBSTR(MEMNAME,4,4)) NE 'DONE';
QUIT;
PROC DATASETS LIB=WORK NOLIST;
DELETE &CDA_DEL_LIST;
DELETE &WEB_DEL_LIST;
RUN; QUIT;
I just ran this program a few minutes ago, produced the report, and deleted
all the associated datasets without having to name them individually.
There's probably a better way to do this, but I found this approach very
useful.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic