Help using Base SAS procedures

help required with proc report.

Reply
SAS Employee
Posts: 73

help required with proc report.

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.
SAS Super FREQ
Posts: 8,740

Re: help required with proc report.

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]
Ask a Question
Discussion stats
  • 1 reply
  • 96 views
  • 0 likes
  • 2 in conversation