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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 18313 views
  • 7 likes
  • 6 in conversation