I'm new to mata and have a syntax problem I can't seem to solve. I got a program for testing for stochastic dominance and when I try to run this I get a syntax (198) problem which says ( `min' invalid name) so it's related to how the min is specified. Here is the portion that I think contains the error. Something I noticed is that it was meant for stata 6 but I'm using stata 12 and I've changed the version name at the top but haven't changed anything else.
#delimit ;
program define dom; * syntax is dom var1 wgt1 var2 wgt2 zmax #test-points;
version 6.0;
local x1 `1';
local wgt1 `2';
local x2 `3';
local wgt2 `4';
local zmax = `5';
local num = `6';
summarize `x1', meanonly;
local min1 = r(min);
summarize `x2', meanonly;
local min2 = r(min);
local min = max(`min1',`min2');
local inter = (`zmax'-`min')/(`num'-1);
local min = `min’ + `inter’; * Don’t start at very end of tail;
local inter = (`zmax'-`min')/(`num'-1);
local done = 0;
local s = 1;
tempvar ind;
display " ";
display "Minimum test point is " `min';
display " ";
display "Maximum test point is " `zmax';
display " "; if `zmax' <= `min' {;
local done = 1;
display " ";
display in red "Error: " in yellow "Max test point is not larger than
min test point!";
display " ";
};
while `done' == 0 {;
display " ";
display "Order " `s';
display "Z D1 D2 t-statistic";
local alpha = `s' - 1;
local i = 1;
local z = `min';
quietly gen `ind' = .;
while `z' <= `zmax' {;
Sorry if this is too much but I've only started using mata today and amn't sure exactly where the problem is.
#delimit ;
program define dom; * syntax is dom var1 wgt1 var2 wgt2 zmax #test-points;
version 6.0;
local x1 `1';
local wgt1 `2';
local x2 `3';
local wgt2 `4';
local zmax = `5';
local num = `6';
summarize `x1', meanonly;
local min1 = r(min);
summarize `x2', meanonly;
local min2 = r(min);
local min = max(`min1',`min2');
local inter = (`zmax'-`min')/(`num'-1);
local min = `min’ + `inter’; * Don’t start at very end of tail;
local inter = (`zmax'-`min')/(`num'-1);
local done = 0;
local s = 1;
tempvar ind;
display " ";
display "Minimum test point is " `min';
display " ";
display "Maximum test point is " `zmax';
display " "; if `zmax' <= `min' {;
local done = 1;
display " ";
display in red "Error: " in yellow "Max test point is not larger than
min test point!";
display " ";
};
while `done' == 0 {;
display " ";
display "Order " `s';
display "Z D1 D2 t-statistic";
local alpha = `s' - 1;
local i = 1;
local z = `min';
quietly gen `ind' = .;
while `z' <= `zmax' {;
Sorry if this is too much but I've only started using mata today and amn't sure exactly where the problem is.
Comment