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 (March 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 26 Mar 2008 19:56:00 -0700
Reply-To:   jfh@stanfordalumni.org
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Subject:   Re: Multiple formats same variable for reporting
Comments:   cc: hgobjuka2001@gmail.com
Content-Type:   text/plain; charset="ISO-8859-1"

You've already gotten some answers; here's another one: use CALL DEFINE to define the format on-the-fly.

Here's an example which I think can be modifed to suit your needs:

===== data test (keep=decimals value displayed); do i = 1 to 5; do decimals = 0 to 3; value = ranuni(95605) * 10; displayed = value; output; end; end; stop; run;

proc report data=test nowindows missing nocenter; columns value decimals displayed; define _all_ / display; compute displayed; call define(_col_, 'format', '10.' || put(decimals, z1.0)); endcomp; run; =====

The example uses different formats according to the value of the variable DECIMALS. You could just as easily have it assign the format name according to the value of your variable TYPE.

On Mar 26, 12:15 pm, Gobjuka <hgobjuka2...@gmail.com> wrote: > Hi All, > > I have a dataset having field Val that holds value in multiple > formats > if Type = USD then format applied to Val is dollar10. > if Type = Mean then format applied to Val is 12.2 > if Type = PCT_GRP then format applied to Val is percent8.2 > > Data temp; > input Type $ Date mmddyy6. Val > cards; > USD 020106 2000 > USD 020206 2500 > USD 020306 3000 > Mean 020106 22.56 > Mean 020206 10.23 > Mean 020306 15.34 > PCT_GRP 020106 0.15 > PCT_GRP 020206 0.34 > PCT_GRP 020306 0.46 > run; > > I am building a report using proc report. Was not sure how this > multiple formats could be applied on the same value. Any clue ??? > > proc report data=temp nowindows heading; > column Type Val,Date; > define Type /group; > define Val /analysis ' ' format=; > define Date /across ' '; > run; > > Thank you, > > Hassan

-- Jack Hamilton Sacramento, California jfh@alumni.stanford.org


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