DATA Step, Macro, Functions and more

Changing color and styling for character variables

Reply
New Contributor
Posts: 4

Changing color and styling for character variables

Hi Team,

 

I need to change color or make bold to character variable using proc format.

Please find below the code used.


data dsn;
length State County Community $10.;
input State $10.
County $9.
Community $8.
flag 2.
;
datalines;
California Calveras Wallace 1
;
run;


proc format cntlout=colormodel(keep=fmtname start end label type sexcl eexcl);
value $State 'California' = "fontWeight:bold;";
value flag 1 = "";
run;

data colormodel(drop=T);
set colormodel(rename=(TYPE=T));
length TYPE $32;
if FMTNAME eq 'STATE' then TYPE = 'flag';
else TYPE = 't';
run;

 

data colormodel;
format state $state.;
set dsn;
run;

 

Thanks,

Arnav

Super Contributor
Posts: 345

Re: Changing color and styling for character variables

Text decoration is only possible in reporting procedures. There are numerous papers explaning anything relevant in detail.

Super User
Posts: 19,789

Re: Changing color and styling for character variables

That's not how proc format works. It acts as a recoding procedure with the rules being the input. 

Style such as colour and font are not valid in a SAS dataset. 

 

So what are you trying to do?

New Contributor
Posts: 4

Re: Changing color and styling for character variables

Yes I am trying to change Style such as colour and font  in a SAS dataset  to show in a web browser through SAS SNA and this browser is accessing this table and i need to do conditional highlighting

Super User
Posts: 19,789

Re: Changing color and styling for character variables

Search on lexjansen.com for papers by Cynthia Zender that show how to create stylish reports.

 

 http://support.sas.com/resources/papers/proceedings13/366-2013.pdf

Ask a Question
Discussion stats
  • 4 replies
  • 192 views
  • 0 likes
  • 3 in conversation