turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Proc Report Set a Column Bold based on another Col...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 03:47 AM

I have a Proc Report that goes like this

Proc Report Data=Table1;

Column A B C;

compute A;

if B eq 0 then call define(_col_,"style","style={font_weight=bold}");

endcomp;

Run;

However, it doesn't work.

The log says that B is uninitialized. Is there a way to solve it? Thanks before.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 04:00 AM

proc report is from left to right .

compute A; ----> compute B; or compute C;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 04:06 AM

Sorry, I don't think I get the point. So how do I compute/set variable A based on Variable B? Thanks.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 05:10 AM

proc reports reads the variable from left to right, when computing A, B has no value. You have to clone B:

```
Proc Report Data=Table1;
columns B=_B A B C;
define _b / noprint;
compute A;
if _b eq 0 then call define(_col_,"style","style={font_weight=bold}");
endcomp;
run;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 05:13 AM

compute block is calculated from left to right. So when you compute it at A , SAS can't know the value of B, because B is after A. Change : compute A; ----> compute B; or compute C;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 06:02 AM

I try to do like below (re-arranging the column)

Proc Report Data=Table1;

Column B A C;

compute A:

if B eq 0 then call define(_col_,"style","style={font_weight=bold}");

endcomp;

Run;

And still unsuccesful, can you let me know what did I miss out? Thanks.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 08:50 PM

You are defining _COL_ ,so you can only highlight A not B. Change it as compute B:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2016 10:16 PM

Hi: for a concrete example of how PROC REPORT works, review this related posting:

It has some pseudo-code examples of PROC REPORT's left-to-right processing and how a COMPOUND name has to be used for numeric variables.

cynthia