Hi Guys,
I have two tables as shown in the attachment. I want to create the result table, which is shown at the bottom of the attachment:
Can someone give me a hand please? I really appreciate everyone who have been helping me so far.
Is the DIAG function what you are looking for? It will convert any vector into a diagonal matrix. For example
proc iml;
a = diag({1 2 3});
print a;
quit;
Thanks for your reply. But i believe its something more to that. Can you please have a look at the data which is attached?
i want the values from a different table to be replaced with the diagonals. Appreciate your input and time.
I am not understanding what you want, so can you explain in more detail please? How do you want to make Table 2 from Table 1? The step after that is just the DIAG function, as the 2nd "22" in the result matrix is a typo, right?
Ah, Sorry Ian. My bad. You are right.
I guess i'm not able to think straight now 🙂
Diag is the option. i was wandering how to put that in the shape of table 1.
proc iml;
N=nrow(table1);
test= diag(table2);
result=??
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.