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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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