Date: Thu, 31 May 2001 16:47:54 +0100
Reply-To: DavidJohnson@HALIFAX.CO.UK
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Johnson <DavidJohnson@HALIFAX.CO.UK>
Subject: Re: My date format
Content-Type: text/plain; charset=iso-8859-1
There it is. If you don't use it, you forget it is there. My little grey
cells jangled at Euro dates, but I didn't connect that with EURF. Another
benefit of consulting in Germany Peter? Aside from IR35!!
I actually don't like picture formats. They have a nasty habit of
truncating numeric values. If they aren't well specified they can lead to
incorrect output. I see the following is still in the documentation:
CAUTION:
The picture must be wide enough for the prefix and the numbers. In
this example, if the value -45.00 were formatted with NOZEROS. the result
would be 45.00 because it falls into the first range, low - -1, and the
picture for that range is not wide enough to accommodate the prefixed minus
sign and the number.
I use them here to format a number that is always ten bytes long... in a
string not unlike the US Social Security number. But that is a fixed and
known length. I remember a utility company that set up a 1970's mainframe
billing program with short floating point decimal numbers for currency
values. They didn't believe anyone would ever be billed more than $100 for
3 months energy usage!!! A former colleague got a lot of work fixing their
billing and reporting systems. I've seen bad picture formats produce
similarly inaccurate reports because they don't produce the overflow results
of native formats. An example for those who may not have seen this result:
132 proc format;
133 picture fine low - 99999 = '£000000'
134 other = [comma8.];
NOTE: Format FINE has been output.
135 picture bad low - high = '£00000';
NOTE: Format BAD has been output.
136 run;
137 data fred;
138 value = 123456;
139 put 'comma7. a good outcome ' value comma7.;
140 put 'comma6. Sas does its best ' value comma6.;
141 put 'comma5. the format switches ' value comma5.;
142 put 'fine. the picture is avoided' value fine.;
143 put 'bad. somebody stuffed it' value bad.;
144 run;
comma7. a good outcome 123,456
comma6. Sas does its best 123456
comma5. the format switches 123E3
fine. the picture is avoided 123,456
bad. somebody stuffed it 23456
NOTE: The data set WORK.FRED has 1 observations and 1 variables.
NOTE: At least one W.D format was too small for the number to be printed.
The decimal may be shifted by the "BEST" format.
Unfortunately, the note regarding the small format does NOT relate to my
picture format!
** ##*
David Johnson
* 07080 81 8399
* sasuser@dkvj-cons.com
* http://www.dkvj-cons.com
This message is attributable to the sender and does not necessarily reflect
the view of Halifax Group plc or its subsidiaries.
> ----------
> From: Peter Crawford[SMTP:peter.crawford@db.com]
> Sent: 31 May 2001 17:09
> To: DavidJohnson@halifax.co.uk
> Cc: SAS-L@listserv.uga.edu
> Subject: Re: My date format
>
>
> perhaps Drako has a practical request for the sas ballot
> I don't know how many customers would like the EURFdate formats
> extended beyond european languages(plus I notice in v8 on line doc,
> Africaans), but the ballot survey provides one way of letting SAS
> Institute know how important this might be.
>
> When referring to currency formats I assume, below, David Johnson is
> considering their INPUT, because for OUTPUT we can write a picture
> format to prefix (or suffix) any value with a symbol of choice.
>
> The EURO format feature set includes a "still to be documented (and
> perhaps implemented in production)" feature which allows the Euro
> symbol(?) to be defined by a debug string. This enables the equivalent
> of a sterling informat to input and tolerate values prefixed by GBP(£)
> signs
>
> Until Drako can persuade SAS Institute to extend DFLang and date
> format support to the language of his preference, he may follow the
> advice David has offered, and use a cntlin dataset for proc format.
> Then at least he can avoid another program Ian Whitlock would neatly
> categorise as "wallpaper".
>
> Regards
>
>
>
> Datum: 31/05/2001 15:42
> An: SAS-L@listserv.uga.edu
>
>
>
>
> Antwort an: DavidJohnson@halifax.co.uk
>
> Betreff: Re: My date format
> Nachrichtentext:
>
>
> Drako's email appears below:
>
> SAS-L Digest - 31 May 2001 - Special issue (#2001-673)
>
> Hi Drako,
>
> I gather 'STU' and 'LUY' are abbreviations for month names in a language
> other than English. If your intention is to write a translation like
> 'Janvier', 'Fevrier' etc for months by date number, then you mightlike to
> try the following:
>
> . Create a character value format that converts the english month
> names into the language you want to use
> . Then apply a double formatting statement to your variable like so:
>
> NewName = Put( Put( Date, MonName9.), MyDate.) || Put( Date,
> Year4.);
>
> I suppose I should be surprised that there isn't a native naming format
> for
> months in various foreign languages... but then the currency of the
> largest
> stock exchange in the world is only formatted in SAS by either mapping the
> '$' symbol to a '£' symbol, or by using the Euro format!!!
>
> The other solution I wrote a long time ago to a similar problem... (the
> SAS
> format defined the taxation quarters differently to our own local taxation
> rules) was to build the format using a data step and a CntlIn statement.
> So if my data covered 1979 to 2001, I looped through that range of dates
> and
> assigned them to a format value based on the year and part of the year.
> Then that was loaded into a format library with the CntlIn option on the
> Format procedure.
>
> 10338 Data DATEFMT;
> 10339 Length Label $40;
> 10340 TYPE = 'N';
> 10341 FMTNAME = 'MYDATE';
> 10342 Do START = '01Jan1979'd to '31may2001'd By 1;
> 10343 END = START;
> 10344 If Put( START, MMDDYY4.) <= '0331' Then
> 10345 LABEL = Put( START - 365, Year4.) || '03';
> 10346 Else If Put( START, MMDDYY4.) <= '0630' Then
> 10347 LABEL = Put( START - 365, Year4.) || '04';
> 10348 Else If Put( START, MMDDYY4.) <= '0930' Then
> 10349 LABEL = Put( START, Year4.) || '01';
> 10350 Else LABEL = Put( START, Year4.) || '02';
> 10352 Output;
> 10353 End;
> 10354 Run;
>
> NOTE: The data set WORK.DATEFMT has 8187 observations and 5 variables.
> NOTE: The DATA statement used 0.63 seconds.
>
>
> 10355 Proc Format Lib = WORK CntlIn = DATEFMT;
> NOTE: Format MYDATE has been output.
> 10356 Run;
>
> This solution starts the taxation year on 1 July and increments the
> quarters
> into the next year. The tax year is still defined as 2000 if in 2001 the
> date is before 30 June.
>
> Not the most elegant solution, but it works, and as you can see, is fast.
>
> Kind regards
>
>
> ** ##*
>
> David Johnson
> * 07080 81 8399
> * sasuser@dkvj-cons.com
> * http://www.dkvj-cons.com
> This message is attributable to the sender and does not necessarily
> reflect
> the view of Halifax Group plc or its subsidiaries.
>
>
> Date: Thu, 31 May 2001 09:10:03 +0200
> From: Drako <akepka@ELKA.PW.EDU.PL>
> Subject: My date format
>
> Hello,
>
> I must create date format. I write something like this:
>
> proc format lib=work;
>
> picture mydate
>
> '01JAN00'd-'31JAN00'd = %0d'STY'%0y (datatype=date)
>
> '01FEB00'd-'31FEB00'd = %0d'LUT'%0y (datatype=date)
>
> ...;
>
> But in this way I will have to write range for each month each year.
> Do you know better solution?
>
>
> Many Thanks
>
>
>
> --------------------------------------------------------------------------
> ----
> Part of the Halifax Group, Halifax plc, Registered in England No. 2367076.
> Registered Office: Trinity Road, Halifax, West Yorkshire HX1 2RG.
> Represents only the Halifax Financial Services Marketing Group for the
> purposes of advising on and selling life assurance, pensions and unit
> trust business. The Marketing Group is regulated by the Personal
> Investment Authority. Switchboard 01422 333333.
>
>
> ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
>
>
>
>
>
> --
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail ist nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorised copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
>
------------------------------------------------------------------------------
Part of the Halifax Group, Halifax plc, Registered in England No. 2367076. Registered Office: Trinity Road, Halifax, West Yorkshire HX1 2RG. Represents only the Halifax Financial Services Marketing Group for the purposes of advising on and selling life assurance, pensions and unit trust business. The Marketing Group is regulated by the Personal Investment Authority. Switchboard 01422 333333.
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
|