How can we convert this R code into SAS ETS ?
We have run this code on sashelp.air file - see results attached
-------------------------------------------------------------------------- The code -----------------------------------------------------------
#change the path
df<- read.csv("\download\AIR.csv")
lambda=26000
HP_FILTER_AIR= hpfilter(df$AIR,type=c("lambda"),drift=FALSE,freq=lambda)
df$cycle <- HP_FILTER_AIR$cycle
df$trend <- HP_FILTER_AIR$trend
---------------------------------------------------------------------------------------------------------------------------------------------------
Many thanks
See this example in the documentation of the UCM procedure:
SAS Help Center: Trend Removal Using the Hodrick-Prescott Filter
See also this discussion by @rselukar : Solved: Hodrick-Prescott Filter Comparison - SAS Support Communities
Calling @Rick_SAS
Check PROC TIMESERIES and its options:
OUTTREND= OUTSEASON=
P.S. check the examples in documentation,
Check PROC UCM
And I quote:
The UCMs are also called structural models in the time series literature. A
UCM decomposes the response series into components such as trend, seasonals, cycles, and the regression
effects due to predictor series.
See this example in the documentation of the UCM procedure:
SAS Help Center: Trend Removal Using the Hodrick-Prescott Filter
See also this discussion by @rselukar : Solved: Hodrick-Prescott Filter Comparison - SAS Support Communities
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.