BookmarkSubscribeRSS Feed
pacman94
Calcite | Level 5

I would like to take MEAN and Standard Deviation by Arms for Var1 through Var6

 

Here is the dataset

IDVar1Var2Var3Var4Var5Var6Arm
15619 9A
261 115612B
39 1222  A
4 36610 A
5663  5A
6154 769A
7 14   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

2 REPLIES 2
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller
Reeza
Super User
You only listed one name after the variables you specified, Ie N = N. You need to provide a variable name for each value, N = N1-N6 instead.
Or don't specify anything and let SAS name it using the autoname option as illustrated by PaigeMiller.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 702 views
  • 1 like
  • 3 in conversation