BookmarkSubscribeRSS Feed
Pavan_SAS
SAS Employee
group stats drug-a drug-b
(n=50) (n=50)
a min 22 23
avg 12 34
group stats drug-a drug-b
(n=50) (n=50)
b min 82 63
avg 52 74

above result(table) in rtf format.

i want to repeat column names for each group, by using proc report.
how?
help me, by providing exact code.
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
Using a COMPUTED column, you can make a variable that will display on each row of your group. For example, REGION is the GROUP variable in the following report. It will have repetitious values suppressed on every report row for Asia and Canada.

However, the computed report item, DISPREG is a report column that will hold and display the value for each region. You can still make REGION a group variable, but then use the NOPRINT option so that it is not displayed on the report. But, DISPREG will be displayed on every line of the report, because you assign it the value of a temporary variable HOLDREG, which you grab from REGION on the first row of every group (when REGION has a value).

cynthia
[pre]
proc sort data=sashelp.shoes out=shoes;
where region in ('Asia', 'Canada');
by region;
run;

ods html file='seegroup.html' style=sasweb;
proc report data=shoes nowd;
column region dispreg product sales inventory;
define region/group noprint;
define dispreg/computed 'Region';
define product / group;
define sales/ sum;
define inventory/ sum;
compute before region;
length holdreg $40;
holdreg = region;
endcomp;
compute dispreg / character length=40;
dispreg=holdreg;
endcomp;
run;

ods html close;
[/pre]

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 599 views
  • 0 likes
  • 2 in conversation