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

Hi

I would like to highlight rows in a table output using  proc tabulate but only get this error messages  "ERROR: Format references are not allowed:"

This is how I programmed my test: 

1. at first create format for specific colors

 

proc format lib=work;
value temp

1=red
2=purple
3=orange
4=pink
6=yellow
other=blue;
run;

 

2. then apply this format in ODS/proc tabulate statement :

 

ods excel file=....;

proc tabulate data=_input_data order=data S=[foreground=black];
class x / style={background=temp.};
class y/ style=<parent>;
var _some_variable;

table x*y,_some_variable;

run;

ods excel close;

 

x-variable contains values such as 1,2,3,4

y-variable contains classification values such as '01','02',.....'05.4.3'

 

 

3. Now I'm expecting to get x and y highlighted based on the values in x

No success, only above mentioned error-message. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If the values you want to highlight are the row or column headers for a CLASS variable that would go into a CLASSLEV statement.

 

Since the format you show is only for numeric variables I have to assume it applies to your X variable.

proc tabulate data=_input_data order=data S=[foreground=black];
class x y; classlev x / style={background=temp.}; classlev y/ style=<parent>; var _some_variable; table x*y,_some_variable; run;

But you may need to provide some data and more details of what you actually want the appearance to look like

View solution in original post

2 REPLIES 2
ballardw
Super User

If the values you want to highlight are the row or column headers for a CLASS variable that would go into a CLASSLEV statement.

 

Since the format you show is only for numeric variables I have to assume it applies to your X variable.

proc tabulate data=_input_data order=data S=[foreground=black];
class x y; classlev x / style={background=temp.}; classlev y/ style=<parent>; var _some_variable; table x*y,_some_variable; run;

But you may need to provide some data and more details of what you actually want the appearance to look like

nieminek
Calcite | Level 5

Thank you @ballardw 

This works fine and solution is easy. 

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 995 views
  • 0 likes
  • 2 in conversation