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 (November 1999, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 2 Nov 1999 22:02:55 +0100
Reply-To:   peter.crawford@DB.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Crawford <peter.crawford@DB.COM>
Subject:   Re: SAS Date problem
Comments:   To: TWB2@pge.com
Comments:   cc: sas-l@uga.cc.uga.edu
Content-type:   text/plain; charset=us-ascii

The nesting of informats to deal with special values (whether retained or not) works a treat !

As for the use of a quoted string range for a numeric informat, remember that an informat expects to read text

paste this into your session

proc format fmtlib; invalue dbdate '01/01/0001' = .D other = (| ddmmyy10. |) ; data xx; length text $12 ; attrib db2dat format = date9. informat = dbdate.; input text $ @1 db2dat ; if db2dat = .D then do; thatmiss = 'null 1' ; db2dat = . ; end; put _all_; cards; 01/02/99 01/01/01 01/01/0001 ;

I got a log like this (winNT 6.12 ts060) 429 cards;

TEXT=01/02/99 DB2DAT=01FEB1999 THATMISS= _ERROR_=0 _N_=1 TEXT=01/01/01 DB2DAT=01JAN2001 THATMISS= _ERROR_=0 _N_=2 TEXT=01/01/0001 DB2DAT=. THATMISS=null 1 _ERROR_=0 _N_=3 NOTE: The data set WORK.XX has 3 observations and 3 variables. NOTE: The DATA statement used 0.18 seconds.

Datum: 02.11.99 21:12 An: Peter Crawford/Zentrale/DeuBaExt Kopie: sas-l@uga.cc.uga.edu

Betreff: RE: SAS Date problem Nachrichtentext:

Will that work? I am (slightly) aware of nesting informats, but I did not realize you could mix character comparisons and numeric informats like that. If so, then the original poster can either use your informat as supplied (although my browser ruins the square brackets around the nested informat) or change the .D to plain . and keep me happy.

Tim Berryhill - Contract Programmer and General Wizard TWB2@PGE.COM or http://www.aartwolf.com/twb.html Frequently at Pacific Gas & Electric Co., San Francisco The correlation coefficient between their views and my postings is slightly less than 0 > ---------- > From: peter.crawford@db.com[SMTP:peter.crawford@db.com] > Sent: Tuesday, November 02, 1999 12:05 PM > To: TWB2@pge.com > Cc: sas-l@uga.cc.uga.edu > Subject: RE: SAS Date problem > > > > well that is emphatic enough ... no > I was considering a user informat to handle such situations, almost > transparently > invalue dbdate > '01/01/0001' = .D > other = (! ddmmyy10. !) > ; > I don't like to throw away the info, so to meet Tim's preference, I'd > follow the > use of such an informat with data step statements like > if thatdate = .D then > do; > thatmiss = 'null 1' ; > thatdate = . ; > end; > > Clearly, this isn't how the db2 interface would work, but..... > > > > > Datum: 02.11.99 20:52 > An: Peter Crawford/Zentrale/DeuBaExt > sas-l@uga.cc.uga.edu > > > > Betreff: RE: SAS Date problem > Nachrichtentext: > > > > Peter, Perhaps a special missing value is appropriate here, perhaps > standard > missing values are appropriate here. I tend to avoid the special missing > values. Casual coders test for equality to . more often than they test > for > less than or equal to .Z, so unless there is a specific reason for the > missing value, I just use .. Even if there is a specific reason for the > missing value, I just use .. If there are a variety of specific reasons > for > missing values, I still just use ., and I add a field for storing the > reason. > Tim > > ---------- > > From: peter.crawford@db.com[SMTP:peter.crawford@db.com] > > Sent: Tuesday, November 02, 1999 11:19 AM > > To: TWB2@pge.com > > Cc: SAS-L@listserv.uga.edu > > Subject: Re: SAS Date problem > > > > would you consider using a special missing like .D for specifics like > this > > ? > > > <SNIP> > > > >


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