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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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