I would like to apply the state-space model to my longitudinal dataset. The datasets consist of daily-collected data in 14 weeks from about 200 subjects, similar to the one provided in the SAS example https://documentation.sas.com/doc/en/etscdc/14.3/etsug/etsug_ssm_examples04.htm. However, the subject ID is not included in the code. So, does PROC SSM incorporate the subject ID information, or is it similar to the classic time series analysis (for one subject -- ignoring the subject ID)?
Would anyone know the reference code for an implementation? Thank you!
As a reference:
proc ssm data=dataset; id time; trend growth(ps(2)); irregular wn;/*wn is white noise, residual error*/ model y = treatment growth wn; eval y_predict = treatment + growth; output out=For; quit;
Hello,
if you have time series for several subjects, you have time-series cross-sectional data, aka panel data.
For panel data you can use PROC TSCSREG, PROC PANEL, PROC CPANEL, PROC MIXED(, PROC GLIIMIX) or PROC SSM indeed.
See here :
SAS 9.4 / Viya 3.5 -- SAS/ETS User's Guide
The SSM Procedure
Example 34.2 Panel Data: Random-Effects and Autoregressive Models
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/etsug/etsug_ssm_examples02.htm?homeOnFail
Koen
Hello,
Do you want a different SSM analysis for every subject?
In that case
, sort your dataset by subject and time
, and then add a by statement to your code.
by subject_id;
id time;
Good luck,
Koen
Hi Koen,
Thank you for your reply! I knew that we can get different SSM analyses for every subject using "by subject_id;". But is there a possible way to get the population-level fixed effects coefficients?
Best,
Xi
Hello,
if you have time series for several subjects, you have time-series cross-sectional data, aka panel data.
For panel data you can use PROC TSCSREG, PROC PANEL, PROC CPANEL, PROC MIXED(, PROC GLIIMIX) or PROC SSM indeed.
See here :
SAS 9.4 / Viya 3.5 -- SAS/ETS User's Guide
The SSM Procedure
Example 34.2 Panel Data: Random-Effects and Autoregressive Models
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/etsug/etsug_ssm_examples02.htm?homeOnFail
Koen
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.