BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9
compute ENT_STATE;
if upcase(ENT_STATE) not in ('UP','') then
call define (_col_,'STYLE','style={background=#CD5916}');
endcomp;

hello, this works quite well, but actually i want to do this:

compute Tool;
if upcase(ENT_STATE) not in ('UP','') then
call define (_col_,'STYLE','style={background=#CD5916}');
endcomp;

so coloring one column depending on the value of an other variable, this doesn't work for me... any tips?

define Tool / display ;
define ExecBy/ display;
define Ent_State / display; Message was edited by: Filipvdr
5 REPLIES 5
deleted_user
Not applicable

Hello,




does the Tool variable is before ENT_STATE variable in your column statement?



Marius

Filipvdr
Pyrite | Level 9
Yes

column OperSeq OpersAway Facility Lot_ID Operation PreferredTool OperParValue WaferstobeprocessedNr oCycleTime ExecBy OperOwner dpHold Holdnote ProcessEngineer Holdcode BatchEngineer Route Datim DaysOper Ent_State oper24 oper48;
/* Start Defining Columns */
define OperSeq / display ;
define OpersAway / display ;
define Facility / group;
define Lot_id /group;
define Operation / display width=15 FLOW;
define PreferredTool / display ;
define OperParValue / display ;
define WaferstobeprocessedNr / display ;
define oCycleTime/ display;
define ExecBy/ display noprint;
define OperOwner / display ;
define DpHold / display ;
define HoldNote / noprint ;
define ProcessEngineer / noprint ;
define HoldCode / noprint ;
define BatchEngineer / noprint ;
define Route / noprint ;
define Datim / display noprint ;
define DaysOper / display noprint ;
define Ent_State / display;


Tool = PreferredTool Message was edited by: Filipvdr
deleted_user
Not applicable

hello,



I don't see your Tool variable on the column statement, but anyway I will give an example based on alises which may help you in solving your issue. the key is to have the values of the variable in the if clause availabe before the vlues of the variable you are trying to "polish":



[pre]
proc report data=sashelp.class nowd ;
column name=name_n age sex name ;

define name_n / noprint;
define sex / width=5 center;

compute sex;
if upcase(name_n) not in ('Alfred','') then
call define (_col_,'STYLE','style={background=#CD5916}');
endcomp;

run;
[/pre]

Marius
Filipvdr
Pyrite | Level 9
Ok, thanks, that worked.

Next question:

If the ent_state is not up, then i want PreferredTool (Ent_state) to be displayed

compute PreferredTool;
if upcase(ENT_STATE) not in ('UP','') then
call define (_col_,'STYLE','style={background=#CD5916}');
if upcase(ENT_STATE) not in ('UP','') then
PreferredTool = PreferredTool || "(" || ENT_STATE || ")" || ;
endcomp;
Filipvdr
Pyrite | Level 9
solved it by making this field in the dataset which is used Message was edited by: Filipvdr

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