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

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

1 ACCEPTED SOLUTION
3 REPLIES 3
Ksharp
Super User

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.

 

 

J111
Obsidian | Level 7

Thanks a lot - this code gives the wanted results !

proc expand data=sashelp.air out=fexp method=none ;
id date;
Convert air=hpt/transformout=(hp_t 26000) ;
Convert air=hpc/transformout=(hp_c 26000) ;
run ;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 3 replies
  • 2088 views
  • 2 likes
  • 3 in conversation