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 (April 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 14 Apr 2000 20:38:36 GMT
Reply-To:     Myra.Oltsik@RESPONSEINSURANCE.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Myra.Oltsik@RESPONSEINSURANCE.COM
Organization: Deja.com - Before you buy.
Subject:      Re: date and format programming issue

This worked on my PC using 6.12:

data temp1; input record 3. date yymmdd8. alt yymmdd8.; cards; 0011997080119960209 0021997020119960310 0031996122019951201 0041997010919971230 ; run;

data temp1; set temp1; if date - alt gt 30 then newvar = 1; else newvar = 0; format date alt mmddyy10. ; run;

proc print; run;

OBS RECORD DATE ALT NEWVAR

1 1 08/01/1997 02/09/1996 1 2 2 02/01/1997 03/10/1996 1 3 3 12/20/1996 12/01/1995 1 4 4 01/09/1997 12/30/1997 0

In article <8d7tnp$4ed$1@nnrp1.deja.com>, yorgiv@my-deja.com wrote: > Hi, > > I have a SAS data set with 2 date fields in this format > yyyymmdd. Using SAS 6.12 I need to compare the dates > in this file such that if date is 30 days or more after alt > then new variable obtains value of 1 otherwise 0. > > data temp1; > input record date alt; > cards; > 001 19970801 19960209 > 002 19970201 19960310 > 003 19961220 19951201 > 004 19970109 19971230 > ; > > I cannot perform a mathematical operation with yyyymmdd8. format > (SAS 6.12 does not recoginse it I think). So I substring data: > > data temp1; > set temp1; > date2=substr(date,7,6); > proc print; > run; > data temp1; > set temp1; > alt2=substr(alt,16,6); > proc print; > run; > > Returns: > > OBS RECORD DATE ALT DATE2 ALT2 > 1 1 19970801 19980209 970801 19 > 2 2 19970201 19960310 970201 19 > 3 3 19961220 19951201 961220 19 > 4 4 19970109 19961230 970109 19 > > I don't know why it does this. And I am very frustrated. Can > anyone help me please? > > Yorgi V. > > Sent via Deja.com http://www.deja.com/ > Before you buy. >

Sent via Deja.com http://www.deja.com/ Before you buy.


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