www.sas.com > SAS UK > In the Know Homepage Search | Contact Us     
SAS UK Newsletter Banner SAS - The power to know(tm)  

A Tip to Reduce Coding Time ….
(Written by Thomas Drury, AstraZeneca UK Limited)

I have not been a SAS programmer that long but my work involves creating large numbers of work datasets before merging them to form permanent ones. One tip from a colleague that I have found extremely useful is the colon for specifying datasets. It is used to specify anything which begins with what is to the right of the colon. e.g. A: would mean anything that begins with A.

Normally, I would have had to write this:


PROC DATASETS LIB=WORK NOLIST;
  DELETE 	F1E1 F1E2 F1E3 F1E4 F1E5 
		F1E6 F1E7 F1E8 F1E9 F1E10 
		F1E11 F1E12 F1E13 F1E14 
		F1E15 F1E16 F1E17 F1E18
		F1E19 F1E20 F1E21 F1E22 
		F1E23 F1E24 F1E25 F1E26
		F1E27 F1AD F1ID F1I1 F1F9;
RUN;


With the colon character, all that needs writing to perform the same task as above is:


PROC DATASETS LIB=WORK NOLIST;
  DELETE  F1:;
RUN;

The thing to remember with using this is that it deletes EVERY dataset which begins with F1, so if you actually need some datasets kept then it may be less useful.