Hi,
Doing a proc report i have some issues regarding the format of my output.
So i did this but this is not exactly what i want :
proc report data = a ;
column ( '^{style[color=red]Date}' ('Category of the product sold before the month' '^{style[color=red]Company n°1784}' var1 var2 ... ;
... ;
run ;
Here "Company n°1784" is like a subheader of "Category of [...] month" but what i want is to display "Company n°1784" below "Category of [...] month" but recognized in the same header in order to have this excel output :
So this was the first part of the problem.
Now, after that, i have another issue when exporting the output on an excel worksheet.
Instead of displaying the header as shown above, it displays it like that on excel:
(Yet, it is displayed correctly on the SAS report).
Thanks
Hi:
When I run your code with some fake data, the headers have some odd placement; but the header seems to be colored as you want
I used this code running on a Windows system with 9.4M7:
If you want your spanning header for Company n°1784 to be in the blank box, then I think you need to move one of your ending parentheses so it is after pct_tot.
When I altered the column statement to move just one of the ending parentheses, I got these results:
Cynthia
Why not put it all together and using split char ?
Or @Cynthia_sas could give you right answer.
proc report split='/'
('Category of the product sold before the month / ^{style[color=red]Company n°1784}'
Hi,
Thank you, now "Company n°1784" is under the other text.
Do you know why it's not in red ? The code you shared is not putting "Company n°1784" in red.
Also, i still have this problem below :
Hi,
Hope this code helps. This is what i've done :
title color=red bcolor=red "xxxx" ;
ods excel file = "..../file.xlsx"
options(sheet_interval='none' embedded_titles='yes' start_at='1,2' hidden_rows = '2') ;
ods listing;
ods escapechar = '^' ;
options missing=0 orientation=landscape center;
proc report data = a split ='-' nowd headskip center
style(header)={background=white borderwidth=1 bordercolor=black width=150 color=black just=c textalign=c}
style(report)={borderwidth=1 bordercolor=black outputwidth=150 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] Reporting}' ('Category of the product (sold before the date) - ^{style[color=red] Company n°1784}' var1 var2 var3 var4 var5 pct_tot
('Category of the product (sold before the date) - ^{style[color=red] Company n°2001}' var4 var5 pct_tot))
) ;
define var1 / group width=132;
define var2 / group ;
define var3 / group ;
define var4 / analysis sum '...€' style(column)=[borderrightwidth=2 borderrightcolor=black];
define var5 / analysis sum '...€' ;
define pct_tot / computed style(column) = [tagattr = "format:#0.%"] ;
rbreak after / summarize style(summary) = {font_weight=bold background=lightgrey just=r} ;
compute pct_tot ;
pct_tot = var4.sum/var5.sum ;
endcomp ;
run ;
This is what i get :
Replacing the split symbol "/" with "-" helped me to get all the text ("Category [...] date)") on the same line
Now the only problem left is that i want "Company n°...." in red. Since it isn't a defined column i can't change it's style in the define statement (from what i know).
PS:I am sorry if the code isn't very clear, i can't share everything due to confidentiality.
Hi:
It's too bad you can't make some fake data to illustrate the issue. Without data, it's hard to make constructive suggestions. I've formatted your code and highlighted some inconsistencies:
You are mixing LISTING only options with ODS Style overrides. None of your ODS overrides for width have a unit of measure. It's not clear to me what the structure of your data is or why you're repeating var4, var5 and pct_tot in the column statement but with different headers. I don't see how the values will be different.
Cynthia
Hi:
When I run your code with some fake data, the headers have some odd placement; but the header seems to be colored as you want
I used this code running on a Windows system with 9.4M7:
If you want your spanning header for Company n°1784 to be in the blank box, then I think you need to move one of your ending parentheses so it is after pct_tot.
When I altered the column statement to move just one of the ending parentheses, I got these results:
Cynthia
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.