BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi!

I think this is a simple question, but I cannot find the answer. Here is what I have:

day depth
1 50
1 58
1 72
2 46
2 78
2 34
2 75
etc...

How can I calculate a single value (mean of each depth value) for each day?

thank you!
ES
3 REPLIES 3
Kathryn_SAS
SAS Employee
Try the following:

proc means nway mean;
class day;
var depth;
output out=new / autoname;
run;

proc print data=new;
run;
Kathryn_SAS
SAS Employee
Note the revised code below:

proc means nway mean;
class day;
var depth;
output out=new mean= / autoname;
run;

proc print data=new;
run;
deleted_user
Not applicable
Perfect!

Thank you very much!!!

ES

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1228 views
  • 0 likes
  • 2 in conversation