I would like to take MEAN and Standard Deviation by Arms for Var1 through Var6
Here is the dataset
ID | Var1 | Var2 | Var3 | Var4 | Var5 | Var6 | Arm |
1 | 5 | 6 | 1 | 9 | 9 | A | |
2 | 6 | 1 | 11 | 56 | 12 | B | |
3 | 9 | 12 | 22 | A | |||
4 | 3 | 6 | 6 | 10 | A | ||
5 | 6 | 6 | 3 | 5 | A | ||
6 | 15 | 4 | 7 | 6 | 9 | A | |
7 | 1 | 4 | B |
PROC MEANS DATA = test NOPRINT COMPLETETYPES;
FORMAT Arm Arm.;
CLASS Arm/PRELOADFMT;
VAR Var1 Var2 Var3 Var4 Var5 Var6;
OUTPUT OUT = test2(keep = Arm N MEAN STD)
N = N MEAN = MEAN STD = STD;
RUN;
It doesn't pick up all Vars. Just the first one
perhaps this fixes it ... if not, explain further
PROC MEANS DATA = test NOPRINT COMPLETETYPES;
FORMAT Arm Arm.;
CLASS Arm/PRELOADFMT;
VAR Var1 Var2 Var3 Var4 Var5 Var6;
OUTPUT OUT = test2 N= MEAN= STD= /autoname;
RUN;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.