BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
1 REPLY 1
Cynthia_sas
Diamond | Level 26
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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Discussion stats
  • 1 reply
  • 1033 views
  • 0 likes
  • 2 in conversation