Desktop productivity for business analysts and programmers

List Report Wizard - Centering Text Output

Reply
New Contributor
Posts: 2

List Report Wizard - Centering Text Output

I've been able to successfully create a list report with all of the data output I need, but I'm struggling to figure out the formatting side of it. It looks like columns with text and dates are left justified while columns with numbers are right justified which causes some of the columns to run very close together in the report. I've tried several options including creating a custom formatting to center justify and it doesn't seem to be working. Is there an easy way to center justify the column ouputs?

 

Thank you very much!

Trusted Advisor
Posts: 1,052

Re: List Report Wizard - Centering Text Output

Yes and no...

 

List Report uses PROC REPORT, which is the most powerful reporting procedure in SAS. So the general answer is, yes, you can do anything.

 

But not from the point and click interface that EG provides. Because PROC REPORT has so many options, EG is only able to expose a very small percentage of the features. So you're going to have to copy the code that EG is generating, and modify it somewhat.

I don't know your environment, but to get you started here's an example. I ran the List Report wizard on SASHELP.CLASS, making the following changes:

In "Table Properties", I selected "Show every row".
In "Assign Columns", I made every column "Display all values".

Here's the code that resulted:

 

TITLE1 "List Report";
FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";

proc report data=SASHELP.CLASS nowd;
   column Name Sex Age cv1 Height cv2 Weight cv3;
   define Name / display 'Name' missing;
   compute Name;
      if Name ne ' ' then hold1=Name;
      if Name eq ' ' then Name=hold1;
   endcomp;
   define Sex / display 'Sex' missing;
   compute Sex;
      if Sex ne ' ' then hold2=Sex;
      if Sex eq ' ' then Sex=hold2;
   endcomp;
   define Age / display missing noprint;
   define cv1 / computed 'Age' missing;
   compute cv1;
      if Age ne . then hold3=Age;
      cv1=hold3;
   endcomp;
   define Height / display missing noprint;
   define cv2 / computed 'Height' missing;
   compute cv2;
      if Height ne . then hold4=Height;
      cv2=hold4;
   endcomp;
   define Weight / display missing noprint;
   define cv3 / computed 'Weight' missing;
   compute cv3;
      if Weight ne . then hold5=Weight;
      cv3=hold5;
   endcomp;
   run;
quit;
TITLE; FOOTNOTE;

 

For a numnber of reasons relating to the functioning of the wizard, this code ended up more complicated than necessary. You could get a basic report using just this code:

 

proc report data=SASHELP.CLASS nowd;
   column Name Sex Age Height Weight;
   define Name / display missing;
   define Sex / display missing;
   define Age / display missing;
   define Height / display missing;
   define Weight / display missing;
quit;

 

So work from there. You'll need to adapt this code for the special things that you've done using the wizard, which I'm sorry to say may not be easy. And then the trick to centering your columns is just to add the "center" keyword:

 

   define Name / display center missing;

 

on each of your "define" statements.

 

I hope this gives you some options.

   Tom

New Contributor
Posts: 2

Re: List Report Wizard - Centering Text Output

thank you!

Ask a Question
Discussion stats
  • 2 replies
  • 107 views
  • 0 likes
  • 2 in conversation