BookmarkSubscribeRSS Feed
Calcite | Level 5

I have an arrays like this


data prob_matrix;

set B_estimates;



array theta theta1-theta9;






 Where theta1 to theta9 are 9 columns from a 9by9 matrix. Now I want to convert the Array theta into a long row. The resulting row vector is then 9*9=81 cells wide, since row 1,2 3 etc from theta are put next to eachother


Diamond | Level 26 RW9
Diamond | Level 26

Well, I would advise that that is not the best layout, going the other way would be more beneficial, i.e. having 81 records and 2 columns.  Far easier to work with.  Anyways something like - and note that this is not tested as you have not provided test data in the form of a datastep.


data want (drop=i);
  set have end=last;
  array final{81} 8;
  retain final:;
  array theta{9};
  if _n_=1 then mult=0;
  do i=1 to 9;
  if last then output;



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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation