BookmarkSubscribeRSS Feed
rhapsody
Calcite | Level 5

I have an arrays like this

 

data prob_matrix;

set B_estimates;

  

 

array theta theta1-theta9;

 

end;

 

 

 

 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

 

1 REPLY 1
RW9
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;
    final{(mult*9)+i}=theta{i};
  end;
  if last then output;
run;

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 1 reply
  • 404 views
  • 0 likes
  • 2 in conversation