LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 14 Mar 2000 13:56:07 -0500
Reply-To:     WHITLOI1 <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         WHITLOI1 <WHITLOI1@WESTAT.COM>
Subject:      Re: convert the date format from mmddyy to ddmmyy
Comments: To: John Whittington <John.W@MEDISCIENCE.CO.UK>
Content-Type: text/plain; charset=US-ASCII

John,

Now to clear the air with some straight forward code, try this from a 6.12 log.

12 13 data _null_ ; 14 set w ; 15 put _n_= ; 16 run ;

_N_=5 _N_=4 _N_=3 _N_=2 _N_=1 _N_=0 _N_=-1 NOTE: The DATA statement used 0.16 seconds.

Ian Whitlock <whitloi1@westat.com>

____________________Reply Separator____________________ Subject: Re: convert the date format from mmddyy to ddmmyy Author: John Whittington <John.W@MEDISCIENCE.CO.UK> Date: 3/14/2000 6:06 PM

At 11:21 14/03/00 -0500, Anne.Marie.Smith@ASTRAPHARMACEUTICALS.COM wrote:

>Paul, >It is not a great idea to use "ddmmyy" as a variable name either, >its a reserved word, the SAS proper name of a format. The practice of using >reserved words >as variable names creates all kinds of unnecessary duplicate reference problems >for the >SAS language compiler :-) which may give you wildly erronious results.

Anne Marie, whilst I agree that there are some coding practices that can be (accidentally or deliberately - have you ever seen Art Carpenter's presentation?!!) potentially confusing to human readers of the code, the SAS compiler does not really have much (if any) of a concept of 'reserved words', so that the 'wildly erroneous results' you suggest are really not much of a risk. In any event, if anything were a reserved word', it would be 'ddmmyy.' rather than 'ddmmyy'

If you still think that the SAS compiler thinks in terms of 'reserved words', then have a play with the following (which does exactly 'as the doctor ordered'- and, yes, does produce output!):

data retain ; retain retain return input ; input input where if until merge retain ddmmyy8. ddmmyy8 $ ; array sqrt(*) where ; if sqrt(1) > 20 ; if if = where ; set = merge ; end = if ; stop = until ; do = 9 ; do do = if to until ; leave = do ; continue = end ; if if > input then link return ; end ; return: return = retain ; return ; cards ; 16 24 24 99 25 14/03/99 John ; run ; proc print data = retain ; run ;

In virtually all cases, the SAS compiler handles that abomination 'correctly' (in terms of my twisted mind, as writer of the code) without comment. Only in the case of declaration of the array SQRT(*) does it produce a note indicating that it is going to assume all references to SQRT() relate to the array, and not to a function.

Kind Regards,

John

---------------------------------------------------------------- Dr John Whittington, Voice: +44 (0) 1296 730225 Mediscience Services Fax: +44 (0) 1296 738893 Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk Buckingham MK18 4EL, UK mediscience@compuserve.com ----------------------------------------------------------------


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