BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ksharp
Super User

Yeah. I love ARRAY too.

But your code can be better.

data have;
array test{*}p_5_1-p_5_10; 
do k=1 to 100;
do i=1 to dim(test); 
 test{i}=ceil(ranuni(-1)*68);
end;
 output;
end;
drop i k;
run;


data want; set have;
array test{*}p_5_1--p_5_10;
array _ind{*} ind1-ind68;
do i=1 to dim(test); 
 _ind{test{i}}=1;
end;
drop i;
run;


Ksharp

AndreaAb
Calcite | Level 5

Works perfect! I still have a lot to learn! Thank you so much!

Smiley Happy

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 16 replies
  • 18589 views
  • 7 likes
  • 6 in conversation