|
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
|