/* LOC.G: procedure to find variable positions corresponding to a list of variable character mnemonics for a Gauss dataset John Rust, Yale University, March, 1997 Inputs: vnames: vector of names whose position numbers are to be returned dsnames: list of variable names from a Gauss dataset (getname) */ proc (1)=loc(vnames,dsnames); local i,r,vpos; r=rows(vnames); vpos=zeros(r,1); if r > 1; i=1; do until i > r; vpos[i]=maxindc(stof(vnames[i]) .== stof(dsnames)); if ((vpos[i] == 1) and (stof(vnames[i]) ./= stof(dsnames[1]))); /* "Error in LOC.G: no match for "$+vnames[i]; */ vpos[i]=-1; endif; i=i+1; endo; else; vpos=maxindc(stof(vnames) .== stof(dsnames)); if ((vpos == 1) and (stof(vnames) ./= stof(dsnames[1]))); /* "Error in LOC.G: no match for "$+vnames; */ vpos=-1; endif; endif; retp(vpos); endp;