Date: Tue, 30 Dec 2008 09:24:45 -0600
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Quickly identify variables by text strings and include them
Content-Type: text/plain; charset=ISO-8859-1
Lots of ways you can do that. Look at the functions that start with the
letter 'V', such as varfmt() - you could do something as simple as
array vars _NUMERIC_;
do i = 1 to dim(vars);
if varfmt(vars[i])='DATE9.' then do *whatever;
Also look at the sashelp documentation on varfmt (and similar functions) as
it has a very similar example using open() which is more efficient if you
are trying to do something to the variable and not the data set contents
Finally, if they all START with the same thing, then you can use the :
DTstuff DTstuff2 DTstuff3
is all identified by DT: in most functions (for example, x = sum(of DT: )
would give all DT variables' sum into x).
On Tue, Dec 30, 2008 at 9:10 AM, D T <firstname.lastname@example.org> wrote:
> I need to run a quick check on all date variables (formatted as dates) in a
> data set, and I have many of them. Is there a way that I could identify the
> date variables quickly within a SAS program to include them into an array?
> The variable names for the dates contain either the text string "dt" or
> "dat". Does anyone have a suggestion?
> It's the same Hotmail(R). If by "same" you mean up to 70% faster.