Sorry if this a duplicate posting, I tried to edit my previous version of this question and I can no longer find it so I'm asking again. Anyway, I am using SAS v 9.4 and I want to create a report that displays every level of a format that is being applied. I am conditionally applying formats to a secondary group variable based on the value of a primary group variable and I want each value of the appropriate format to appear in the table. Here is an example data set: data temp;
input score unscorable bad segment $ i;
datalines;
. 1 1 B 1
. 1 0 B 1
. 1 1 B 1
0 1 0 A 1
0 1 1 A 1
0 1 1 A 1
500 0 1 A 1
501 0 1 B 1
501 0 0 A 1
501 0 1 A 1
503 0 0 A 1
503 0 1 A 1
504 0 0 B 1
505 0 0 B 1
506 0 1 B 1
507 0 0 B 1
508 0 0 A 1
509 0 0 B 1
510 0 0 A 1
510 0 0 B 1
510 0 0 A 1
;
run; These are the two formats I am using: proc format;
value scoref
500-501 = "500-501"
502-503 = "502-503"
504-505 = "504-505"
506-507 = "506-507"
508-509 = "508-509"
510-511 = "510-511"
512-513 = "512-513"
;
value unscf
. = "."
0 = "0"
;
run; And here is my proc report: title "Overall";
proc report data=temp missing;
column unscorable _unscorable score i bad;
define unscorable / group noprint;
define _unscorable / computed noprint;
define score / group "Score";
define i / analysis sum "#";
define bad / analysis sum "# Bad";
compute _unscorable;
if unscorable not = ' ' then do;
hold = unscorable;
end;
_unscorable = hold;
endcomp;
compute score;
if _unscorable = 0 then do;
call define('score', 'format', 'scoref.');
end;
else if _unscorable = 1 then do;
call define('score', 'format', 'unscf.');
end;
endcomp;
break after unscorable / ol ul summarize;
rbreak after / ol ul summarize;
run; Right now the "512-513" level of scoref is not being displayed in this report. What I would like is for all levels of scoref to show up when _unscorable = 0 and all levels of unscf to show up when _unscorable = 1. Eventually, I am planning on creating two tables, one for segment = A and one for segment = B. I would like these tables to have the same number of rows. I have tried using preloadfmt with completerows, but can't get it to work. Thanks!
... View more