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. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 707 views
  • 0 likes
  • 2 in conversation