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

I want a movsum 4 but I don't want that first couple of observations that are computed with 1, 2, 3 observations.  I only want observations that are computed with 4 observations.  I have several by groups so it is not that easy to just delete them. Is there a way to tell proc expand not to include them or an easy way to delete when you have many by groups. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
dw_sas
SAS Employee

Hi,

 

You can add the TRIMLEFT 3 operand after the MOVSUM 4 specification in your CONVERT statement to set the first 3 moving sum values within each BY group to missing.  For example:

 

convert x=movsum_x / transform=(movsum 4 trimleft 3);

 

I hope this helps!

DW

View solution in original post

1 REPLY 1
dw_sas
SAS Employee

Hi,

 

You can add the TRIMLEFT 3 operand after the MOVSUM 4 specification in your CONVERT statement to set the first 3 moving sum values within each BY group to missing.  For example:

 

convert x=movsum_x / transform=(movsum 4 trimleft 3);

 

I hope this helps!

DW

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

Discussion stats
  • 1 reply
  • 1372 views
  • 1 like
  • 2 in conversation