SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

To Find out the Groupwise Means

Reply
N/A
Posts: 0

To Find out the Groupwise Means

Hi All,
In my Project Requirement is like this .Suppose i have datasets called d1 and d2 as follows

data d1;
input g vari;
datalines;
1 123
1 121
1 120
2 121
2 120
;
data d2;
input g vari ;
datalines;
1 121
1 122
1 123
2 122
2 125
;
I want to Findout the groupwise means

My output is like this How can i findout

1 121.5
2 122

Appriciate Great Help

Regards,

Govind.
SAS Super FREQ
Posts: 8,820

Re: To Find out the Groupwise Means

Hi:
Proc MEANS is the procedure that springs to mind. The question however, is whether you want to find the means for D1 and D2 separately, or whether you also want to combine the two files together BEFORE you use PROC MEANS.

To simply concatenate the 2 datasets, a SET statement would be the most useful:
[pre]
data all_d;
set d1 d2;
run;

proc means data=all_d;
class g;
var vari;
run;
[/pre]

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 184 views
  • 0 likes
  • 2 in conversation