The SAS Output Delivery System and reporting techniques

proc print to proc report

Reply
Occasional Contributor
Posts: 18

proc print to proc report

How can the following be done using proc report?

-------------------------------------------------------------

proc print data=a split='\' noobs label (report)=[rules=none];

    title2 j=c c=red "#byval1 - " c=blue h=0.8 "#byval2";

    by project category;

    var x y z / style=[just=c vjust=c leftmargin=2mm rightmargin=2mm ];

    var a b  / style=[ vjust=c leftmargin=2mm rightmargin=2mm ];

    var iunits / style=[just=c vjust=c leftmargin=2mm rightmargin=2mm ];

    var est extes /style =[ vjust=c leftmargin=2mm rightmargin=2mm ];

    sum estimate / style(grandtotal)=[background=red foreground=white]

    style(total)=[background=black foreground=white];

sumby category;

run;

-------------------------------------------------------------

Thanks;

Masoud

SAS Super FREQ
Posts: 8,743

Re: proc print to proc report

Hi:

  You will have to read about PROC REPORT for a full example. Basically, you will have a COLUMN statement that will list your items, from left to right. Then instead of multiple VAR statements, you will need a DEFINE statement for every item that you want to change, style-wise. (Also, you should consider using the correct syntax for the style override. For PROC PRINT, it is STYLE(DATA)={...} but for PROC REPORT, it will be
STYLE(COLUMN)={...}, as shown below.

  PROC REPORT does totals differently than PROC PRINT does. You may find that you need both a BREAK and/or an RBREAK statement in order to get both subtotals and grand totals at the end of the report. You may or may not need BY group processing -- a BREAK statement does SUBTOTALS and an RBREAK statement does a grand total. You can use a STYLE= option for these on the BREAK or RBREAK statement.

   You did not say what your destination of interest was. However, a value of .8 for H (which corresponds to font size) seems rather odd. It is better to specify units of measure for font size. A simple point size specification would be better: H=12pt or H=6pt or H=8pt -- any of those would work for RTF, PDF or HTML. Also, valid values for VJUST (or VERTICALALIGN) are T (top), M (middle) or B (bottom).

http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/viewer.htm#a002972093.htm

  Some papers that talk about PROC REPORT are:

http://www.pharmasug.org/proceedings/2012/TF/PharmaSUG-2012-TF20-SAS.pdf

http://www2.sas.com/proceedings/sugi31/235-31.pdf

http://www2.sas.com/proceedings/sugi30/244-30.pdf

http://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf

cynthia


** untested code -- not at computer with SAS;

proc report data=a split='\' nowd
            style (report)=[rules=none];
    by project category;
    title2 j=c c=red "#byval1 - " c=blue h=0.8 "#byval2";
  COLUMN x y z a b iunits est estes estimate;
  define x / display style(column)=[just=c vjust=m leftmargin=2mm rightmargin=2mm ];;
  define y / display  style(column)=[just=c vjust=m leftmargin=2mm rightmargin=2mm ];
  define z / display  style(column)=[just=c vjust=m leftmargin=2mm rightmargin=2mm ];

... more DEFINE statements ....

  rbreak after / summarize style=[background=red foreground=white];
run;

Ask a Question
Discussion stats
  • 1 reply
  • 252 views
  • 0 likes
  • 2 in conversation