Hi:
It looks like you have duplicate observations in your data. If this is an acceptable condition, then you have several choices:
1) Use PROC SORT to create a temporary data set that does not hold any of the duplicate observations and then use PROC PRINT for your REPORT;
2) Use PROC REPORT, but define ALL the variables as GROUP variables so that all the duplicate rows collapse into 1 row (where every column is exactly the same)
3) Use PROC REPORT, but add up all the numeric variables (assumes that the duplicate observations are valid.
For example, given this data with the variables NAME, VAR1 and VAR2:
[pre]
alan 1 1
alan 1 1
alan 1 1
bob 2 2
bob 2 2
bob 2 2
carl 3 3
carl 3 3
carl 3 3
[/pre]
I can produce these results:
[pre]
Proc PRINT with Dups removed by Proc SORT
Obs name var1 var2
1 alan 1 1
2 bob 2 2
3 carl 3 3
******************************************************
Proc REPORT with all variables as GROUP
Number
name var1 var2 of Obs
alan 1 1 3
bob 2 2 3
carl 3 3 3
******************************************************
Proc REPORT with Sum of Numeric variables
Number
name var1 var2 of Obs
alan 3 3 3
bob 6 6 3
carl 9 9 3
[/pre]
It really depends on what the significance of the duplicate observations are and how you want them to be treated. (There's probably a PROC SQL SELECT DISTINCT solution for removing dups....but this should be enough to get you started).
cynthia
[pre]
*** the code;
data mydata;
infile datalines;
input name $ var1 var2;
return;
datalines;
alan 1 1
alan 1 1
alan 1 1
bob 2 2
bob 2 2
bob 2 2
carl 3 3
carl 3 3
carl 3 3
;
run;
proc sort data=mydata nodupkey out=data2;
by name var1 var2;
run;
ods listing close;
options center nodate nonumber;
ods html file='c:\temp\nodups.html' style=sasweb;
**1) remove dups with PROC SORT and then PRINT;
proc print data=data2;
title 'Proc PRINT with Dups removed by Proc SORT';
run;
**2) Use PROC REPORT and define all vars as GROUP;
proc report data=mydata nowd;
title 'Proc REPORT with all variables as GROUP';
column name var1 var2 n;
define name /group;
define var1 / group;
define var2 / group;
define n / 'Number of Obs';
run;
**3) Use PROC REPORT and define some vars as GROUP, SUM the others;
proc report data=mydata nowd;
title 'Proc REPORT with Sum of Numeric variables';
column name var1 var2 n;
define name /group;
define var1 / sum;
define var2 / sum;
define n / 'Number of Obs';
run;
ods _all_ close;
[/pre]