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.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 2850 views
  • 1 like
  • 3 in conversation