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

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
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
  • 1949 views
  • 0 likes
  • 2 in conversation