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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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