BookmarkSubscribeRSS Feed

Hi Everyone,

Could you help me resolve this problem please!

I have this data set

     name      x1          x2

john           23          12

jenny          54          10

carol          21            11

amber          56          8

1.highlight x1 if x2 is greater than 10

2.the out put should contain only name and x1 (i.e x2 has to be removed).

3.I want the report in RTF file

Thanks for your help.

Ram Adhikari

2 REPLIES 2
Robert_Bardos
Fluorite | Level 6

Tip 1: GIYF (google is your friend) search for "sas proc report conditional highlighting"

Tip 2: download and study Cynthia Zender's presentation available from e.g.

         http://www.lexjansen.com/pharmasug/2007/hw/hw03.pdf

Other hints:

  • ODS RTF
  • PROC REPORT
    • Column order matters for COMPUTE statements ('name x2 x1')
    • look up PROC REPORT's DEFINE statement and its NOPRINT option (your 'x2' variable)
    • STYLE option with COMPUTE

Hope this helps getting you started

Robert

Scott_C_Moore
Calcite | Level 5

This should get you what you want.

data names;

input name $ x1 x2;

cards;

john     23 12

jenny   54 10

carol    21 11

amber 56 8

;

run;

ods rtf file='myfile.rtf';

proc report data=names nowd;

column name x2 x1;

define name / display;

define x2 / display noprint;

define x1 / display;

compute x1;

     if x2 gt 10 then

     call define (_col_,'style','style={background=red});

endcomp;

run;

ods rtf close;

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