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

Hello All,

 

I am working with Proc Expand and have a quick question.  I am pretty good wiht this procedure, but there is somemthing that I can't figure out.

 

I have data that takes the following form:

 

Obs      ID         Value:

1          1              3

2          1              4 

3          1              6

4          1              1

5          1              3

6          1              2

7          1              5

8          1              5

9          1              9

10          1              2

etc.

 

and I want to get a backwards looking moving average that DOES NOT take into account the current observation.  So, for example, if I wanted the the three obs backward moving average, I have been using TRANSFORMOUT = (movave 3) and then changing the obs value and remerging, but I want to be able to do that in one step in proc expand, so that I don't have to worry about data issues when remerging.

 

Ultimately, this is what i want:

 

The three day backward moving ave for obs 4 would be 13/3 and not 11/3.  I hope that makes sense.

 

Thanks!!

 

John

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

How about, simply:

 

convert value=y / transformout=(movave 3 lag 1);
PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

How about, simply:

 

convert value=y / transformout=(movave 3 lag 1);
PG
mahler_ji
Obsidian | Level 7

Thank you very much!  Didn't know you could put those commands together like that!

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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