BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
P_S_
Obsidian | Level 7

Hi,

I have a question about controlling style options with PROC REPORT and ODS EXCELXP tagsets.

I am using SAS 9.4 (M2) and I output my PROC REPORT results to EXCEL using EXCELXP tagsets.

 Here is my output and I am having following issues:

 

 my_current_output.png

 

  1. REGION is a variable in the dataset sashelp.shoes. When I use INLINE formatting in this variable (superscript with 3), it does NOT show up as BOLD and RED in color. You can see all other variables are in red color with bold weight. I need this in BOLD and RED.
  2. EAST COAST and WEST COAST are NOT the variables in the dataset. These are created in COLUMN statement. The color is red and it is BOLD which is exactly what I want. But I need to control the background and want yellow and green background.
  3. Eastern States(superscript 1) and (Western States superscript 2) are also NOT the variables in the dataset. They are also created in the COLUMN statement. Here both have INLINE FORMATTING with superscript 1 and 2 respectively. Here I lose the red color as well as bold but I need those. I also need a background of different colors (say blue and black).

 This is the output I would like to have:

 

my_desired_output.png

 Thank you for the help.

 

THE CODE IS IN THE ATTACHMENT (code.txt).

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Similar, just use style background [color=blue]

If combining you only need one STYLE but you have multiple options

Style background [color=blue] foreground [color=red]"text"

 

Look in the reference for style options you have things like font size, weight (bold and such) borders (where appropriate) justification (left right center)

View solution in original post

5 REPLIES 5
ballardw
Super User

I think you want to repost your code and possibly in the insert code window (look at the {i} or SAS run icon in the menu of the display. It looks like some of your code may be getting eaten by HTML interpretter (at least in my view) as there are man missing closing brace and parentheses.

P_S_
Obsidian | Level 7

Thank you Ballardw for pointing this out.

I have now posted the code as an attachement. Hopefully that will work and people will be able to see the code.

ballardw
Super User

See if this helps:

ods tagsets.excelxp
file  = "D:\data\shoes_test.xml"
   style = styles.mystyle
   options (orientation    ='landscape'
            autofit_height ='yes'
            );
   ods escapechar='~';

PROC REPORT DATA=SASHELP.SHOES(obs=5)  SPLIT="/" nowd ;
   COLUMN  ("EAST COAST" "~{style foreground [color=red fontweight=bold]Eastern States~{super 1}}" Region Product Subsidiary)
           ("WEST COAST" "~{style foreground [color=red fontweight=bold]Western Stores~{super 2}}" Sales Inventory Returns );
   DEFINE  Region     / DISPLAY  "~{style foreground [color=red fontweight=bold]Region~{super 3}}" ;
   DEFINE  Product    / DISPLAY  "Product" ;
   DEFINE  Subsidiary / DISPLAY  "Subsidiary" ;
   DEFINE  Sales      / SUM      "Total Sales" ;
   DEFINE  Inventory  / SUM      "Total Inventory" ;
   DEFINE  Returns    / SUM      "Total Returns"  style(header)={background=light grey};
RUN;
ods tagsets.excelxp close;
P_S_
Obsidian | Level 7

This works. Thank you ballardw.

I also want to add the background color to the "Eastern States" - let's say a blue color. I am having difficultly with the syntax to add the background. Is there a way to add background color?

ballardw
Super User

Similar, just use style background [color=blue]

If combining you only need one STYLE but you have multiple options

Style background [color=blue] foreground [color=red]"text"

 

Look in the reference for style options you have things like font size, weight (bold and such) borders (where appropriate) justification (left right center)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 3321 views
  • 1 like
  • 2 in conversation