I get the following error with the code:
ERROR 124-185 when macro with array is invoked more than once in DATA step. I have read the post but I don't quite understand how it applies to my code. The specific log is:
data test;
input param $ sub1 treat $ subn ;
cards;
logit -1.11 ates -0.03
logit -1.11 bref -0.03
ka2 -0.50 bref -0.01
ka2 -0.50 ates -0.01
;
run;
data test1;
set test;
if Param in( 'logit' );
array subj(*) subj1-subj34;
array sub(*) sub1-sub34;
do i=1 to 34;
subj(i)=1/(1+exp(-sub(i)));
end;
run;
RUN;
data test2;
set test;
if Param in( 'logit' );
array subj(*) subj1-subj34;
array subn(*) subn1-subn34;
do i=1 to 34;
SUBJ(i)=1/(1+exp(-subn(i)));
end;
run;
RUN;
Since you do not have a variable subn1 (or subx1) in your input dataset, the array consists entirely of missing values.
Hi @jacksonan123 You have a variable in your Input dataset named SUBN. Therefore that causes a conflict with your 2nd array name at compile time in TEST2
5655 data test2;
5656 set test;
5657 if Param in( 'logit' );
5658 array subj(*) subj1-subj34;
5659 array subn(*) subn1-subn34;run;
----
124
ERROR 124-185: The variable subn has already been defined.
Please choose a different array name.
Since you do not have a variable subn1 (or subx1) in your input dataset, the array consists entirely of missing values.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.