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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.