BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
EpiNovice
Calcite | Level 5

Good morning, I need help with code to create a variable that is the mean of a series of values from a long data set. For example, the data I have looks like this:

IDEventTime (ms)
1A1.2
1B3.3
1A1.1
1B2.3
1A0.9
1B1.9
1A1.4
2A2.3
2B3.2
2A1.9
2B2.8
2A1.7
2B3.1

 

And what I need is data that looks like this:

 

IDEventMean time (ms)
1A1.14
1B2.43
2A1.95
2B3.03

 

Do I need to reformat to wide dataset to accomplish this, or is there another way?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ
PROC MEANS DATA=HAVE MEAN NWAY;
 CLASS ID EVENT;
 VAR TIME;
 output out=work.ContainsMean mean= / autoname;
RUN;

Koen

View solution in original post

1 REPLY 1
sbxkoenk
SAS Super FREQ
PROC MEANS DATA=HAVE MEAN NWAY;
 CLASS ID EVENT;
 VAR TIME;
 output out=work.ContainsMean mean= / autoname;
RUN;

Koen

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 1 reply
  • 539 views
  • 0 likes
  • 2 in conversation