BookmarkSubscribeRSS Feed
mmurph15
Fluorite | Level 6

Hi there -

I'm new to using Proc Report and a relative beginner in SAS coding in general. I use SAS 9.4 windows environment. I'm trying to produce some simple quarterly reports. The data is pretty straightforward- several variables where the values are either 1 or missing. I want the columns to display a checkmark if the value is 1 and leave blank if missing. (I haven't figured out how to do this yet, but my code has missing assigned to display "~" for now.) I want a summary row at the bottom of the report displaying the total number of checkmarks in each column.

 

My problem is with the summary row  - I want it to display a total number of the number of checkmarks in each column. The way it's working now, is that it is displaying a checkmark instead of a "1" if the total is "1". it is correctly displaying numbers if the total is >1. So, it's applying the format I applied to the variables it is summarizing. Does someone know how to fix this?

 

Here's a screenshot of my results  I want that third column total line to display a "1," not a checkmark. Any advice would be very much appreciated!!  (My code is below.)

 

mmurph15_0-1634819801244.png

 

an excerpt of my code:

 

ods escapechar='^';

proc format ;
*this code creates a "checkmark" glyph for reports ;
value check 1="^{unicode '2713'x}"
.='~';
run;

 

proc report data=convert;
column FW_IDname ("Key Activities" nFWA_B01-nFWA_B03);
define FW_idname / group display "Worksite ID|Name"; 
define nFWA_B01 / analysis sum "Recruited, ID'd Partners" center format=check.;
define nFWA_B02 / analysis sum "Assessed" center format=check.;
define nFWA_B03 / analysis sum "ID'd Areas for Improvement" center format=check.;
by grantee;
where FW_Idname ne "";
rbreak after /summarize dol ;
compute after ;
FW_idname='Total';
call define (_row_, "style", "STYLE=[font_weight=bold]") ;
endcomp;

run;

2 REPLIES 2
Kurt_Bremser
Super User

You need to override the format for the summary line. Add additional CALL DEFINE statements:

compute after ;
  FW_idname='Total';
  call define (_row_, "style", "STYLE=[font_weight=bold]") ;
  call define (2,"format","3.");
  call define (3,"format","3.");
  call define (4,"format","3.");
endcomp;

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 628 views
  • 2 likes
  • 2 in conversation