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 (May 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 1 May 2007 03:09:35 -0400
Reply-To:     Peter Crawford <peter.crawford@BLUEYONDER.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@BLUEYONDER.CO.UK>
Subject:      Re: dates/concatenate
Comments: To: Ryan McNeill <RMcNeill@OKLAHOMAN.COM>

On Mon, 30 Apr 2007 22:27:43 -0500, Ryan McNeill <RMcNeill@OKLAHOMAN.COM> wrote:

>Hi all, > > I've got a problem I can't seem to solve using the SAS docs or >Little SAS book. I need to concatenate three number fields. I know you >use the || on a character string. > Essentially, I have separate fields for years, months and days --- >and I need to be able to deal with them. Of course, all this is >contingent to minds smarter than me telling me I don't have to create a >new column to figure out, say, an age with those three fields. > >Thanks.

Ryan

have a look at the examples in on-line help for the function datdif()

For concatenation, see the function string= cats( 2007, 4, 30 ); (You might not like the result having only one character for the month)

To represent a numeric sas-date in yyyymmdd format, use function string = put( date_var, yynnddN8. ) ;

To convert 3 numbers holding year, month and day into a sas date, use function mdy() like: date_var = mdy( monthvar, dayvar, yearvar );

But I think your best advice is to read some more books, and a lot of on-line doc, and when you have any spare time, lurk on sas-L or read through the SAS-L archives, which would have revealed all the answers above, faster than I can type them !

Peter Crawford


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