BookmarkSubscribeRSS Feed
bookage
Fluorite | Level 6

Hello,

 

I only have SAS enterprise guide installed (i.e. no SAS PC), and I'm not able to run PROC IML , and my purpose is to build a Markov Chain Model (the datasets are saved on SAS servers, some internet server of my company I believe). 

 

So could anyone tell me how to build such model with all I have now?

 

Thanks very much!

 

 

 

9 REPLIES 9
TomKari
Onyx | Level 15

(Don't you hate it) Let me answer a question with a question: why do you mention not having SAS PC?

 

Is your question a theoretical one of how to build the model, or do you know how to do it with SAS PC, and are wondering how to do it using EG?

 

Are you aware that you can submit SAS code in a code window in EG, just like you can on SAS PC?

 

Also, if the server used by your EG installation is licensed for IML, you can also submit IML jobs in EG.

 

Tom

bookage
Fluorite | Level 6

Thank you so much for your reply Tom! 

 

Let me answer your questions, hope my answers would be clear to you:

 

why do you mention not having SAS PC? -- because I did some search and found that PROC IML can be run in SAS PC

 

Is your question a theoretical one of how to build the model, or do you know how to do it with SAS PC, and are wondering how to do it using EG? -- my main question is to build the model using EG

 

Are you aware that you can submit SAS code in a code window in EG, just like you can on SAS PC? -- yes

 

Also, if the server used by your EG installation is licensed for IML, you can also submit IML jobs in EG. -- unfortunately, I'm not able to run PROC IML, so I guess IML is not licensed on my EG version?

 

so based on these conditions, do you have any suggestion? Thanks again!

TomKari
Onyx | Level 15

Perfect! Thanks for the nice clear answers.

 

First, take a look at the reply from @mkeintz, and if he solves your problems, you're away to the races.

 

Second, double check whether you can successfully run IML from EG. There is an issue between these two, in that every time you submit code EG puts a "quit;" statement in automatically, so you can't run IML in interactive mode. If you're licensed for IML, though, you can still run it using "proc iml". For instance, the following (from an introductory paper by Rick Wicklin) runs fine in a code window in EG on my machine:

 

proc iml; /* In SAS/IML Studio, PROC IML stmt is optional */
/* convert temperatures from Celsius to Fahrenheit scale */
Celsius = {-40, 0, 20, 37, 100}; /* vector of temperatures */
Fahrenheit = 9/5 * Celsius + 32; /* convert to Fahrenheit */
print Celsius Fahrenheit; /* send to ODS destination */
quit;

 

 

And finally, if you really can't run IML, I suggest you repost in the Analytics/SAS Statistical Procedures community, with a title like "How to build Markov chain model without using IML". That way, the people with good statistical chops will see it. The Enterprise Guide community tends to get posts about actually using EG, not about how to use the underlying SAS code to get challenging statistical results.

 

Good luck!

   Tom

bookage
Fluorite | Level 6

Thank you Tom! I tried the code you provided, and there is no IML licensed indeed, but I can either try mkeintz' method or trying to asking EG community another question. I really appreciated your and @mkeintz ' assistance!

mkeintz
PROC Star

You can do matrix multiplication via PROC SCORE.  Assume two datasets, right and left:

 

data left;
  _type_='SCORE';
  input _NAME_ $7. x1 x2;
datalines;
newvar1 10 20
newvar2 25 40
run;

data right;
  input x1 x2;
datalines;
1 2
2 4
run;

proc score data=right score=left   out=product;
run;

data _null_; set product; put (_all_) (=);run;

 

Proc score is intended to generate factor scores from original data, using the SCORE coefficients generated by proc factor.

 

Somewhere there is probably a well-developed paper on using PROC SCORE for markov chains, .. but I can't readily find it.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
bookage
Fluorite | Level 6

Thank you mkeintz! This is very helpful!

Rick_SAS
SAS Super FREQ

Are you talking about Markov transition models in which the probabilities of transitioning to State K depends on the current state?

See the articles

Yes, both of these article use SAS/IML. Why? Because Markov transition models are inherently about matrix operations (multiplication, inversion, eigenvectors,...) 

 

I realize that not every site licenses SAS/IML, but trying to build a Markov model without high-level matrix operations is going to cost quite a bit of money in terms of your time/salary/sanity for development, testing, and maintenance. If your company thinks these models are important, you might do a cost/benefit analysis to see whether it makes economic sense to license SAS/IML.  If you are going to build something, sometimes it is more efficient to purchase the correct power tools. 

ukg9
Calcite | Level 5

Hi 

If you have completed the model could you please share the SAS code for the same? 

I am currently working on IFRS9 impairment Model of Expected Credit Loss (ECL)

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 6122 views
  • 0 likes
  • 6 in conversation