Date: Wed, 30 May 2001 11:55:17 +0200
Reply-To: "Edel, Christoph (Frankfurt)" <CEdel@DE.IMSHEALTH.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Edel, Christoph (Frankfurt)" <CEdel@DE.IMSHEALTH.COM>
Subject: Re: Data _Null_ Help please
Content-Type: text/plain; charset="ISO-8859-1"
Erica (from Bill Eshelman's account),
perhaps I have had a short night's sleep only after the JP Morgan Chase
Corporate Challenge fun run plus party here in Frankfurt, but I get the
impression that Peter Crawford assists in READing your desired report format
properly, and Paul Dorfman's very appropriate strategy outline to a solution
may require more experience than you have if you are fairly new to SAS (so
pointer control is your favorite topic these days?).
I think you just want to WRITE it without the leading and trailing blanks
around your formatted value.
If that is the case, here goes (tested code):
(This assumes you know already that 32 minus commas will suffice to
represent your data)
data work.test;
x = 12726 ;
output;
x = 1122726;
output;
run;
data _null_;
set work.test;
attrib char length = $32;
char = trim( left( put( x, comma32. ) ) );
put @10 "There were " char
"guaranties for your district";
run;
which yields
47 data _null_;
48 set work.test;
49
50 attrib char length = $32;
51 char = trim( left( put( x, comma32. ) ) );
52
53 put @10 "There were " char
54 "guaranties for your district";
55 run;
There were 12,726 guaranties for your district
There were 1,122,726 guaranties for your district
NOTE: There were 2 observations read from the data set WORK.TEST.
NOTE: DATA statement used:
real time 0.02 seconds
cpu time 0.02 seconds
BTW if you are new to SAS-L: remember those two names Peter and Paul. There
is always something to learn from their postings - I was completely unaware
of the input @ "string" technique, but then, I never had to...
Good night,
Christoph Edel
Christoph Edel
Produktionssupport
IMS Health Frankfurt (Germany) Phone: +49-69-6604-789
Hahnstraße 30-32 Fax: +49-69-6604-600
60528 Frankfurt am Main e-mail: cedel@de.imshealth.com
Euler to Diderot: "Sir, (a+b**n)/n = x, hence God exists; reply!"
> -----Original Message-----
> From: Bill Eshelman [SMTP:lastgear1@MINDSPRING.COM]
> Sent: Wednesday, May 30, 2001 2:34 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Data _Null_ Help please
>
> Hi. I am fairly new to SAS and I am working on a report using Data
> _Null_,
> I have several sentences with some dollar amounts. On one person's report
> the dollar amount may be only 6 figures, but on another it may be 10
> figures. How do I write it so it will have the correct spacing for each
> report regardless of the number of digits.
> i.e instead of looking like this on one report
> there were 12,726 guaranties for your district
> and looking like this on another report
> there were 1,122,726 guaranties for your district
>
> I want it to look like this for each report
> there were 12,726 guaranties for your district
> and looking like this on another report
> there were 1,122,726 guaranties for your district.
>
> Thanks in advance for any help. - Erica