BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
1MoreThing
Calcite | Level 5

Dear All,

I have a long time series of a covariance matrix stored in a sas dataset. For each observation, there are 7 variables variables like:

"date c11 c21 c31 c22 c32 c33"

where c11 - c33 are the lower triangle elements of the cov-matrix.

In order to make use of some matrix routines in IML, I would like to convert each row into a full matrix:

M= {   c11 c21 c31,

          c21 c22 c32,

          c31 c32 c33 }

Could someone provide some suggestions on the transformation please?

Thanks you!

1 ACCEPTED SOLUTION

Accepted Solutions
IanWakeling
Barite | Level 11

Have a look at the SQRSYM and SQRVECH functions which are designed for doing exactly this. If you have read your six variables into the matrix x, something like:

M=sqrvech(x[i,]);

should do the trick for the ith row.

View solution in original post

1 REPLY 1
IanWakeling
Barite | Level 11

Have a look at the SQRSYM and SQRVECH functions which are designed for doing exactly this. If you have read your six variables into the matrix x, something like:

M=sqrvech(x[i,]);

should do the trick for the ith row.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 839 views
  • 0 likes
  • 2 in conversation