Hello everybody,
I want to make a table of a result of the mean procedure. I use codes below to run the mean statemant:
proc means data=have;
var x;
class name time;
run;So, I want a table which keeps name, time and means of x variable as listed in the following table:
| name | time | mean_x |
| A | 1 | 12 |
| A | 2 | 13 |
| A | 3 | 12 |
| A | 4 | 16 |
| A | 5 | 9 |
| B | 1 | 11 |
| B | 2 | 12 |
| B | 3 | 12 |
| B | 4 | 14 |
| B | 5 | 7 |
| C | 1 | 11 |
| C | 2 | 14 |
| C | 3 | 13 |
| C | 4 | 17 |
| C | 5 | 11 |
How can I do that?
Thanks in advance.
This should work:
proc means data=have mean nway; var x; class name time; output out=want (drop= _: ) mean=mean_x; run;
This should work:
proc means data=have mean nway; var x; class name time; output out=want (drop= _: ) mean=mean_x; run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.