BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ccwangxi
Fluorite | Level 6

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

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

View solution in original post

3 REPLIES 3
sbxkoenk
SAS Super FREQ

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

ccwangxi
Fluorite | Level 6

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

sbxkoenk
SAS Super FREQ

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

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