I am creating separate tables for multiple subjects. Some subjects don't have any data. When they don't, I'd like to be able to create the same table that is made for subjects that do have data with the same column headers, but with no rows. In the absence of rows, I'd like to be able to have a line that says 'No Data'.
For example, the following will produce a table with a line of empty data and the note below:
data dat;
Visit='';
Age=.;
Height=.;
Weight=.;
run;
proc report nowd data=dat;
column ('Visit Information' Visit Age Height Weight);
compute after / style=[just=c];
line 'No Data';
endcomp;
run;
What I would like is the same table as what is produced above without the row of empty data in the middle, but with the column headers and the note that says 'No Data'. Obviously, when I use the restriction where visit ne '';
it produces no table at all. Any ideas?
What I did below is conditionally set the row height to zero, plus set all of the various things that might cause the row height to be nonzero to be zero or not present (border, padding/margin, font size).
In HTML this works perfectly; in RTF it works almost perfectly, it's possible there's an additional style option needed, or that it's not possible to completely eliminate the row in RTF.
data dat;
Visit='';
Age=.;
Height=.;
Weight=.;
run;
ods rtf file="c:\temp\test.rtf";
proc report nowd data=dat;
column ('Visit Information' Visit Age Height Weight);
compute visit;
if missing(visit) then do;
call define(_row_,'style','style={height=0px fontsize=0pt margin=0px padding=0px borderstyle=none}');
end;
endcomp;
compute after _page_ / style=[just=c];
line 'No Data';
endcomp;
run;
ods rtf close;
This of course only works if you can have a row present in the data that is missing for the respondent (or at least has one value that you can condition on, missing isn't required).