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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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