The SAS Output Delivery System and reporting techniques

Formating a table with ODS

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Formating a table with ODS

Hi,

I'm fairly new to using ODS and I find it pretty difficult to use when it comes to creating a nice report with the tagset ExcelXp...

The table below is written in an email but I would also like it to be written in an excel document.

I'm trying to output the following table into Excel with a similar style:

                
HEADING1    HEADING2         HEADING3 
Field1Field2Field3Field4Field5Field6Field7Field8Field9Field10Field11Field12
123456789101112

The trick is that the content of the last <TR> should come from a SAS table so at the moment this is what i'm doing:

ods _all_ close;
  ODS listing close;
  ods tagsets.Excelxp file="file.xls" style=SASWeb;
  ods noresults;
  ods tagsets.Excelxp options(sheet_interval="none"
                                    Embedded_titles='yes'
          absolute_column_width = "12"
          sheet_name='TEST');
  Title JUSTIFY= LEFT 'Title';

  proc report data=MATCH nowd;
  columns  var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12;
  define var1 / 'Field1' ;
  define var2 / 'Field2'  ;
  define var3 / 'Field3' ;
  define var4 / 'Field4'  ;
  define var5 / 'Field5' ;
  define var6 / 'Field6'  ;
  define var7 / 'Field7'  ;
  define var8 / 'Field8' ;
  define var9 / 'Field9' ;
  define var10 / 'Field10'  ;
  define var11 / 'Field11' ;
  define var12 / 'Field12' ;
  run;

How can I get ODS to also print the HEADINGS, the field names and the values in this format in an Excel file ?


Accepted Solutions
Solution
‎01-31-2014 08:53 AM
New Contributor
Posts: 3

Re: Formating a table with ODS

This was the solution

proc report data=MATCH nowd style(Header)=[just=center];

columns  ('HEADING1' var1 var2 var3 var4) ('HEADING2' var5 var6 var7) ('HEADING3' var8 var9 var10 var11 var12);

  define var1 / 'Field1' group;

  define var2 / 'Field2'  group;

  define var3 / 'Field3' group;

  define var4 / 'Field4'  group;

  define var5 / 'Field5' group;

  define var6 / 'Field6' group ;

  define var7 / 'Field7' group ;

  define var8 / 'Field8' group;

  define var9 / 'Field9' group;

  define var10 / 'Field10'  group;

  define var11 / 'Field11' group;

  define var12 / 'Field12' group;

   run;

View solution in original post


All Replies
Solution
‎01-31-2014 08:53 AM
New Contributor
Posts: 3

Re: Formating a table with ODS

This was the solution

proc report data=MATCH nowd style(Header)=[just=center];

columns  ('HEADING1' var1 var2 var3 var4) ('HEADING2' var5 var6 var7) ('HEADING3' var8 var9 var10 var11 var12);

  define var1 / 'Field1' group;

  define var2 / 'Field2'  group;

  define var3 / 'Field3' group;

  define var4 / 'Field4'  group;

  define var5 / 'Field5' group;

  define var6 / 'Field6' group ;

  define var7 / 'Field7' group ;

  define var8 / 'Field8' group;

  define var9 / 'Field9' group;

  define var10 / 'Field10'  group;

  define var11 / 'Field11' group;

  define var12 / 'Field12' group;

   run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 325 views
  • 0 likes
  • 1 in conversation