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 (December 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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>..
Comments:   To: "agnew@hsc.vcu.edu" <agnew@hsc.vcu.edu>, "agnew@HSC.VCU.EDU" <agnew@hsc.vcu.edu>
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


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