BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Khaladdin
Quartz | Level 8

Hi all,

I want to ask a quick question. I think I can explain better by using simple sample.

So, I have the following data:

 

Time          Value

13:45          0.2

13:45          0.4

13:45          0.3

13:46          0.1

13:46          0.2

13:46          0.3

13:46          0.5

13:46          0.4

 

I want to add one more column. The value in this column should be the standard deviation for each minute. So, I want to get the following data:

 

Time          Value        St.D

13:45          0.2           0.1  (it is the standard deviation of 0.2,0.4 and 0.3 - so st.dev for 13:45)

13:45          0.4           0.1

13:45          0.3           0.1

13:46          0.1           0.1528  (it is the standard deviation of 0.1,0.2,0.3,0.5 and 0.6 - so st.dev for 13:46)

13:46          0.2           0.1528 

13:46          0.3           0.1528 

13:46          0.5           0.1528 

13:46          0.6           0.1528 

 

Many thanks in advance for your helps.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Just a guess as not guessing what your code structure is nor typing that in:

proc means data=have;
  by time;
  var value;
  ouput out=m stddev=stddev;
run;

data want;
  merge have m;
  by time;
run;

 

 

 

 

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Just a guess as not guessing what your code structure is nor typing that in:

proc means data=have;
  by time;
  var value;
  ouput out=m stddev=stddev;
run;

data want;
  merge have m;
  by time;
run;

 

 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 1 reply
  • 691 views
  • 1 like
  • 2 in conversation