data monika.male (keep=ym wtm &mvars mergeobs);
set monika.mergenew3 ;
array varsa(&k) &vars;
array mvarsa(&k) &mvars;
ym=y;
wtm=wt;
do i=1 to &k;
mvarsa(i)=varsa(i);
end;
if male=1 then output; run;
ERROR: Too few variables defined for the dimension(s) specified for the
array varsa.
How do I solve this error? I am attaching the entire code of Fairlie decomposition. I am working on my thesis and would greatly appreciate any help on this. Thank you.
%let vars= &definegroup1 &definegroup2 &definegroup3 &definegroup4 &definegroup5;
Why not the 6th group? I suspect that's your error.
The following is my opinion - feel free to disregard it all 🙂
Also, this is an efficient way to code. You're hardcoding a lot of things that you should be doing dynamically. Why assign the variables to new variables without doing anything to them? And if you're renaming via a prefix there are technically easier ways.
HOWEVER, if you understand this and it works for you, then work with it.
If you're using someone else's code I have two suggestions:
1. Make sure to work through a known example to ensure it gives you the numbers expected.
2. Comment every line or section to ensure you understand the code.
Hello Reeza,
Thank you so much. My code works now. Actually I have never worked on stata so I have no idea how it works. And since I need to finish my thesis I do not have the time to learn a new software. I will base of my analysis off this code and try to work with it. I may have some more posts regarding this test and would really appreciate your help. Thank you.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.