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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 733 views
  • 0 likes
  • 2 in conversation