The SAS Output Delivery System and reporting techniques

Report

Reply
Contributor
Posts: 26

Report

Can any one tell me how to merge cell in headers as below

AND TO APPLY COLORS LIKE FOLLOW ONLY

BUT MY EG 4.3 NOT ALLOW TO USE TAGSET OR TEMPLETE

CAN ANY ONE HELP ME

SAS Super FREQ
Posts: 8,865

Re: Report

Posted in reply to sravanpathu

PROC TABULATE will do part of what you want. PROC REPORT will do part of what you want. Either way, you will need to either "start" your code with EG and then modify it or just write the code directly. For example, the code below using PROC TABULATE created the screenshot. My program used SASHELP.CLASS, so I had to fake some labels to be the same as the labels you wanted.

Depending on your procedure of choice, you may or may not be able to produce these kinds of spanning headers. SAS is not Excel or Word - -so the methods by which you create "merged cells" in Excel or Word do not necessarily apply in a SAS table.

cynthia

ods _all_ close;

     

ods html file='c:\temp\hilite_eg.html'

    style=egdefault;

  

proc tabulate data=sashelp.class;

  where age in (12, 13, 14);

  class sex ;

  classlev sex / style={background=red};

  class age /style={background=yellow};

  classlev age / style={background=yellow};

  var height / style={background=yellow vjust=m};

  table sex=' ',

        age*n=' ' height*mean=' ' /

  box={label='One' s={background=red}};

  label age='Following'

        height='Three';

run;

   

ods html close;


tab_hilite.jpg
Contributor
Posts: 26

Re: Report

Posted in reply to Cynthia_sas

Dear ma'am,

can we do completely in Report only

Please help me

Regrads

Sravan

SAS Super FREQ
Posts: 8,865

Re: Report

Posted in reply to sravanpathu

Hi:

  REPORT and TABULATE will not look exactly alike, see the attached screenshot. PROC REPORT code is below, since the TABULATE code was already posted.

cynthia

ods _all_ close;

          

ods html file='c:\temp\hilite_eg.html'

    style=egdefault;

                     

proc report data=sashelp.class nowd

  style(header)={background=red};

  title 'PROC REPORT';

  where age in (12, 13, 14);

  column ('One' sex) age,n ('Three' height);

  define sex / group ' '

         style(column)=Header{background=red};

  define age / across 'Following'

         style(header)={background=yellow}

         style(column)={background=white};

  define n / ' ';

  define height / mean ' ' f=9.2

         style(column)={background=white};

run;

ods html close;

title;


compare_tab_report.jpg
Contributor
Posts: 26

Re: Report

Posted in reply to Cynthia_sas

Ma'am,

when am using the code Cells are not merging i want in merged format

SAS Super FREQ
Posts: 8,865

Re: Report

Posted in reply to sravanpathu

Hi:

  That is why I posted the TABULATE example first. The look of the table that you showed CAN be produced with PROC TABULATE, because TABULATE builds headers differently than almost any other SAS procedure. What you call a merged cell is generally a spanning header in SAS and TABULATE most often can give you a spanning header that spans multiple column headers, or gives the appearance of "merging" cells.

  PROC REPORT is not Word or Excel. PROC REPORT is not PROC TABULATE. PROC  REPORT writes one report row to contain the text string 'Following', then it writes another report row for the other strings. Although the "line" between cells can be colored differently,  the division is still there. Even if you made the divider lines red, however, you could not move the text into the middle of the two cells, because that area is occupied by the interior table lines dividing the two cells.

  If the cosmetic look of merged cells is crucial to your report, then consider using PROC TABULATE. If you need PROC REPORT for other purposes, such as computing variables or summarizing or writing custom break lines, then using PROC REPORT, there are no instructions to "merge" the cells above the columns for 'One' and 'Three'.  Also, note that, techniques for coloring the division lines or interior table lines (using bordertopcolor, borderbottomcolor, etc) might work differently in RTF or PDF than in HTML, for example.

  cynthia

Contributor
Posts: 26

Re: Report

Posted in reply to Cynthia_sas

Dear Ma'am,

Can we create multiple work sheets in excel using ODS.

Please share me the code.

Regrads,

Sravan.

SAS Super FREQ
Posts: 8,865

Re: Report

Posted in reply to sravanpathu

Hi, I am teaching today on a computer without access to Internet and typing code on my phone is possible, but I don't like to post untested cod-- and my phone doesn't have SAS.

There have been many previous forum postings and user group papers about using the destination: ODS TAGSETS.EXCELXP to create multi-sheet workbooks. You will have to search Google or the forum for information about how to use ODS and this particular destination to create an XML file that conforms to the Microsoft specification for multi-sheet workbook description.

cynthia

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