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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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