SAS Data Science

Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Viya (Machine Learning), SAS Visual Text Analytics, with point-and-click interfaces or programming
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SC_1991
Fluorite | Level 6

I have a dataset that contains the state details for 50 customers from time T1 to T20. The rows have customer ID followed by the sequence of states they were in for the past 20 time periods. There are only 4 states A, B, C, D. the data looks like this:
 
CUS-ID  T1 T2 ... T20
C1         D C ...  B
C2         C D ... A
...
C50      A C ... B
 
Using Markov chains I want to predict the state at time T21 and the associated probability of being in that predicted state. Is there a way in SAS where I can use a PROC or do I have to code from scratch? I also need help writing the code from scratch if there are no special PROCs.
I also do not have any initial transition probabilities. Is there a good rule that I can base my initial transition probabilities on?
Any help on documentation specific to similar problems will be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

I think you should transform your data like:

 

ID PREV CURRENT

C1 D    C

C1 C   A

 

After that ,using proc freq to get transform probability .

And PROC TRANSPOSE to get transform matrix .

And put this matrix into SAS/IML and do some matrix multiply operator.

View solution in original post

5 REPLIES 5
Ksharp
Super User

I think you should transform your data like:

 

ID PREV CURRENT

C1 D    C

C1 C   A

 

After that ,using proc freq to get transform probability .

And PROC TRANSPOSE to get transform matrix .

And put this matrix into SAS/IML and do some matrix multiply operator.

SC_1991
Fluorite | Level 6

Are you implying that I have only 2 time periods ( prev and current) and then calculate the transition probabilities or did you mean arrange the states from left to right left being the earliest?

Ksharp
Super User

"mean arrange the states from left to right left being the earliest"

vrushankshah
Fluorite | Level 6
Hello were you able to get the answer ? Because I have similar question and I am also looking for some programme to do it

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 2848 views
  • 1 like
  • 3 in conversation