| Date: | Tue, 11 Dec 2001 10:40:55 -0500 |
| Reply-To: | "Fehd, Ronald J." <rjf2@CDC.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Fehd, Ronald J." <rjf2@CDC.GOV> |
| Subject: | tip: proc PRINT format LongCharVar $char<maxLen>.. |
|
| Content-Type: | text/plain |
|---|
> > > Nigel Tufnel <dousk8@HOTMAIL.COM> wrote in message
> > > > "..trim() every freaking char var in the entire program..."
> > > From: Jim Agnew [mailto:agnew@HSC.VCU.EDU]
> > > tell me about it, when "they" use 200 char vars and i'm
> trying to do a simple proc print...
> >
> > ah, trim() will not do any good in that situation.
> > how about:
> > proc PRINT ...;
> > format LongCharVar $char30.;
> From: Jim Agnew [mailto:agnew@hsc.vcu.edu]
> now that tip is a cup of coffee to me... thank you very, very much!!!!
> i shoulda thought of it... but it makes sense..
%LET MAXLEN=0;
data _NULL_;
retain MaxLen 0;
do until(EndoFile);
set LIBRARY.WHATEVER(keep = LongCharVar)
end = EndoFile;
MaxLen = max(MaxLen,length(LongCharVar));
%*....do until(EndoFile); end;
call symput('MAXLEN',trim(left(put(MaxLen,3.))));
run;%PUT MAXLEN<&MAXLEN.>;
proc PRINT data = LIBRARY.WHATEVER;
format LongCharVar $char&MAXLEN..;
viole`
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
---> cheerful provider of UNTESTED SAS code from the KludgeWrx !*! <---
Your task is simple: remove the difference
between how things should be
and how they really are.
-- Ashleigh Brilliant pot-shot #4247
|