LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 24 Jan 2009 19:02:06 -0500
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: data variables
Comments:   To: RamsamyAshley@GMAIL.COM

Ash,

This has been discussed on SAS-L a number of times already and, quite frankly, there isn't an all-inclusive solution that I'm aware of.

The following code is just an expansion of Oleg's proposed solution, but it most definitely has its limitations and won't correctly identify all date variables. However, that said, it might give you some insights into how you might solve your problem:

* build test data set; data test; informat var1 $9.; input something date9. var1 $ var2; attrib birthday length = 8 birthday format = mmddyy10. date1 length = 8 another informat = date9. ; birthday = today(); date1 = today(); another= today(); testvar1=input(var1,anydtdte.); if missing(testvar1) then testvar1=input(var1,date9.); if not(missing(testvar1)) then do; format testvar1 date9.; end; testvar2=input(put(var2,date9.),date9.); if not(missing(testvar2)) then do; format testvar2 date9.; end; cards; 12DEC2008 04151944 17921 12DEC2007 0415194 17922 12DEC2007 15041944 17923 12DEC2007 15APR1944 3 ;

* put column names into macro variable mv ; proc sql noprint; select name into :mv separated by ' ' from dictionary.columns where libname = "WORK" and memname = "TEST" and (index(lowcase(name),"date")>0 or index(lowcase(name),"dt")>0 or index(format,"DATE")>0 or index(informat,"DATE")>0 or index(format,"YY")>0 or index(informat,"YY")>0 or index(format,"DT")>0 or index(informat,"DT")>0 or index(format,"JULIAN")>0 or index(informat,"JULIAN")>0 ) ; quit;

%put &mv;

Art -------- On Thu, 22 Jan 2009 06:59:41 -0800, ash007 <RamsamyAshley@GMAIL.COM> wrote:

>I want to put all the date variable in a macro variable. thanks. > >mv = date1 date2 ....


Back to: Top of message | Previous page | Main SAS-L page