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]

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 559 views
  • 0 likes
  • 2 in conversation