BookmarkSubscribeRSS Feed
elsfy
Quartz | Level 8

Hi,

 

This is a problem i already wrote but couldn't find an answer so i am trying to be more clear on what i want.

 

I did a proc report adding headers above columns. The HTML output shown in SAS Entreprise Guide gives me this : 

isgnr_0-1652197824184.png

 

When exporting it with ODS EXCEL, Excel does whatever it wants and displays it like this : 

isgnr_1-1652197862549.png


While i want an output looking like this : 

isgnr_2-1652198082442.png

 

Here is part of my code : 

ods excel file = "" 
    options(sheet_interval='none' embedded_titles='yes') ; 

ods escapechar = '^'  ;
options missing = 0 orientation=landscape center ; 

proc report data = a split = '-' 
                                style(header)={background=white borderwidth=1 bordercolor=black width=150 color=black just=c textalign=c} 
                                style(report)={borderwidth=1 bordercolor=black just=c}
                                style(column)= {borderwidth=1 bordercolor=black just=r color=black tagattr='format:###,###,###,###,###0'}
                                style(summary)= [just=c textalign=c];
;

column ( '^{style[color=red]Total}'  ('Category (before change/extension) - Performing time'
        var1 var2 var3 );

define var1 / group; 
define var2 / analysis sum ; 
define var3 / analysis sum ; 

run ; 
5 REPLIES 5
Ksharp
Super User

Adding these three styles .

 

ods excel file = "c:\temp\temp.xlsx" 
    options(sheet_interval='none' embedded_titles='yes') ; 

ods escapechar = '^'  ;
options missing = 0 orientation=landscape center ; 

proc report data =sashelp.class nowd split = '-' 
                                style(header)={tagattr="wrap:no" vjust=m asis=on background=white borderwidth=1 bordercolor=black width=150 color=black just=c textalign=c} 
                                style(report)={borderwidth=1 bordercolor=black just=c}
                                style(column)= {borderwidth=1 bordercolor=black just=r color=black tagattr='format:###,###,###,###,###0'}
                                style(summary)= [just=c textalign=c];
;

column ( '^{style[color=red]Total}'  ('Category (before change/extension) - Performing time'
        sex weight height ));

define sex / group; 
define weight / analysis sum ; 
define height / analysis sum ; 

run ; 

ods excel close;

Ksharp_0-1652240567524.png

 

elsfy
Quartz | Level 8
Thank you, really close to what i want. Is it possible to put 'Performing time' under 'Category(before change/extension)' ?
Ksharp
Super User

Ha. That is really uneasy.

 

ods excel file = "c:\temp\temp.xlsx" 
    options(sheet_interval='none' embedded_titles='yes') ; 

ods escapechar = '^'  ;
options missing = 0 orientation=landscape center ; 

proc report data =sashelp.class nowd split = '-' 
                                style(header)={tagattr="wrap:no" background=white 
bordertopwidth=1 bordercolor=black 
borderrightwidth=1 borderrightcolor=black 
color=black just=c textalign=c} 
                                style(report)={borderwidth=1 bordercolor=black just=c}
                                style(column)= {borderwidth=1 bordercolor=black just=r color=black tagattr='format:###,###,###,###,###0'}
                                style(summary)= [just=c textalign=c];
;

column ( '^{style[color=red]Total}'  
       ('^{style[borderwidth=1 bordercolor=white] Category (before change/extension)' 
       ( '^{style[borderwidth=1 bordercolor=white] Performingtime'
        sex weight height )));

define sex / group; 
define weight / analysis sum ; 
define height / analysis sum ; 
run ; 

ods excel close;

Ksharp_0-1652262940272.png

 

Ksharp
Super User

I just learn this option :  flow="tables"

 

ods excel file = "c:\temp\temp.xlsx" 
    options(sheet_interval='none' embedded_titles='yes' flow="tables") ; 

ods escapechar = '^'  ;
options missing = 0 orientation=landscape center ; 

proc report data =sashelp.class nowd split = '-' 
                                style(header)={tagattr="wrap:no" background=white 
bordertopwidth=1 bordercolor=black 
borderrightwidth=1 borderrightcolor=black 
color=black just=c textalign=c} 
                                style(report)={borderwidth=1 bordercolor=black just=c}
                                style(column)= {borderwidth=1 bordercolor=black just=r color=black tagattr='format:###,###,###,###,###0'}
                                style(summary)= [just=c textalign=c];
;

column ( '^{style[color=red]Total}'  
       ('^{style[borderwidth=1 bordercolor=white ] Category (before change/extension) -  Performingtime'
        sex weight height ) );

define sex / group ; 
define weight / analysis sum ; 
define height / analysis sum ; 
run ; 

ods excel close;

Ksharp_0-1653054934258.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1398 views
  • 4 likes
  • 2 in conversation