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 (January 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 21 Jan 1997 15:09:42 GMT
Reply-To:     Jay Weedon <j_weedon@ESCAPE.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Jay Weedon <j_weedon@ESCAPE.COM>
Organization: Zip News
Subject:      Re: string -> date -> string
Content-Type: text/plain; charset=us-ascii

On Mon, 20 Jan 1997 17:10:19 -0500, Tim Pi <fmrco!timpi@UUNET.UU.NET> wrote:

>Hi SAS users, > > I have a string variable yymmdd (e.g 970117). I would like > to convert it into date variable so that I can do some opertaions > to add one day or one week to it, that is, yymmdd + 1 (970118) and > then convert it back as a string variable.

Try something along these lines:

x='970117'; * Define string variable with length 6;


y=input(x,yymmdd8.)+1; * Convert to SAS date and add 1 day; x=put(y,yymmdd6.); * Convert back to string - '970118';

x=put(input(x,yymmdd8.)+1,yymmdd6.); * Or do it all in one step:

Jay Weedon.

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