Hi: You can actually do a lot of this formatting in a COMPUTE block without creating character versions of the variables. See the program below. It doesn't do the exact same things, but should be enough to give you an idea of how it would be done. If you want something like this demographic example, on the other hand: Gender N (PctN) Age Range F 9 (47%) 11-15 M 10 (53%) 11-16 where you have 2 statistics (N and PctN) concatenated together in 1 column on the report or the min/max of age formatted with a dash between them, then you might need to create a character variable prior to your report step or PROC REPORT might be able to compute the character variable for you. I showed an example (several examples) of doing this in my SUGI paper entitled "Creating Complex Reports", which you can find by searching support.sas.com web site. Also, the second step below produces the above example report (with N/PctN and Age Range). cynthia ods listing close; ods html file='c:\temp\diff_fmt.html' style=sasweb; proc report data=sashelp.class nowd; column name sex age height weight ratio; define name / order; define age / display; define height /sum; define weight / sum; define ratio /computed f=percent9.2; compute height; if sex = 'F' then do; call define(_col_,'format','percent9.2'); end; endcomp; compute ratio; ratio = height.sum / weight.sum; if ratio gt .7 then do; call define(_col_,'format','dollar9.2'); end; endcomp; run; ods html close; ods html file='c:\temp\calc_cols.html' style=sasweb; proc report data=sashelp.class nowd; column sex n pctn dispstats age=minage age=maxage disprange; define sex / group; define n / noprint; define pctn / noprint; define minage / min noprint; define maxage / max noprint; define dispstats /computed 'N (PctN)' style(column)={just=r}; define disprange / computed 'Age Range' style(column)={just=r}; compute dispstats/ character length=20; dispstats = cat(put(n,2.0),' (',put(pctn,percent6.),')'); endcomp; compute disprange/ character length=20; disprange = catx('-',put(minage,2.0),put(maxage,2.0)); endcomp; run; ods html close;
... View more