BookmarkSubscribeRSS Feed
SASPrime
Calcite | Level 5

I would like to produce a report table with column headings in two rows - the first row is regular column title, the second row is a count in the format of (n=xxx);

Also, have to include min-max range in first column. Is there a way to do it using ods rtf proc report? Thanks for your help!

 

Demographics Treatment
   (n= xx)
Placebo
(n= xx)

    Total             

   (n=xx)

Mean age                                           
[min-max range]
   
Mean Calculated Body Weight (kg)              
[min-max range]                         
   
2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:
This is very similar to the Demographic report shown in this Global Forum paper: http://www2.sas.com/proceedings/forum2008/173-2008.pdf starting on page 9.

But conceptually, you can do something like this with macro variables.

Example:

** could create these macro variables in a program;
** instead of hardcoding the values;
%let agestr = (N=19);
%let htstr = (N=19);
%let wtstr = (N=19);

ods rtf file='c:\temp\showheader.rtf';

proc report data=sashelp.class split='*'  
   style(header)={background=white}
   style(column)={width=1in};
  column sex age height weight;
  define sex / group ' *Sex';
  define age / "Age*&agestr";
  define height / mean "Avg Height*&htstr" f=8.2;
  define weight / mean "Avg Weight*&wtstr" f=8.2;
run;
ods rtf close;

produces this using ODS RTF:

put_n_header.png

cynthia

SASPrime
Calcite | Level 5

As suggested, used macro variables, and it worked! Thank you!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1190 views
  • 0 likes
  • 2 in conversation