Date: Fri, 30 Mar 2007 11:02:15 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: UPCASE in Keep statement
On Fri, 30 Mar 2007 09:17:21 -0400, Ran S <raan67@YAHOO.COM> wrote:
>Hello,
>
>Can I use UPCASE in the Keep statement? I would like to keep variables with
>capital letters.
>
>Thank you
You cannot use the UPCASE function to screen variable names in the KEEP or
DROP statements or data set options.
If I understand your needs correctly, you can accomplish your task by
inspecting the metadata.
Here is an example.
data before;
retain onlylower ONLYUPPER MiXeDcAsE 0;
run;
proc sql noprint;
select name
into : some_upper separated by ' '
from dictionary.columns
where libname eq 'WORK' and
memname eq 'BEFORE' and
name ne lowcase(name)
;
quit;
data after;
set before;
keep &some_upper;
run;
AFTER contains only the variables ONLYUPPER and MiXeDcAsE.