BookmarkSubscribeRSS Feed
aarathi
Calcite | Level 5

Can anyone tell me how to  do conditional formatting in SAS.

 

regards,

arthi

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Assuming you mean traffic lighting in a report:

https://communities.sas.com/t5/SAS-Procedures/Conditional-formatting-Colors-Colours/td-p/132489

 

If not, please specify your question, giving details such as test data (form of datastep) and example output.

Reeza
Super User

What type of report are you generating, PDF, RTF, HTML, Excel? 

 

You can use Proc report to implement conditional highlighting. 

Ksharp
Super User

Here is an example:

 

proc fcmp outlib=work.functions.smd;
function ftoc(f) $;
length r $ 10;
if f=210 then r='C';
 else if f=211 then r=put(f,yymmdd10.);
  else r='N';
return (r);
endsub;
run;


options cmplib=(work.functions);
proc format;
value ftoc(default=10) other=[ftoc()];
run;
data have;
input  c ;
cards;
210 
211 
212
;
run;
data have;
 set have;
 format c ftoc10.;
run;
proc print;run;

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
  • 3 replies
  • 850 views
  • 0 likes
  • 4 in conversation