02-28-2017 06:15 PM
data monika.male (keep=ym wtm &mvars mergeobs);
set monika.mergenew3 ;
array varsa(&k) &vars;
array mvarsa(&k) &mvars;
do i=1 to &k;
if male=1 then output; run;
ERROR: Too few variables defined for the dimension(s) specified for the
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.
02-28-2017 06:24 PM
%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.
03-01-2017 02:21 PM
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.