if ncase
	rew = 0;
	origv = 0;
	fromlabs = 0;
	
	h_1 = WndCreat ([], "Multiple to Binary", [NaN,NaN,296,466], 2);
	
	CtrCreat (h_1, 510, [9,9,104,16], "All variables");
	h_2 = CtrCreat (h_1, 320, [9,25,112,199], lcase(GetVarName(find(DataVarType))),"h_g=h_2;update();");
	CtrCreat (h_1, 510, [169,9,104,16], "Selected variables");
	h_3 = CtrCreat (h_1, 320, [169,25,112,199], "","h_g=h_3;update();");
	h_4 = CtrCreat (h_1, 150, [129,105,32,20], "","");
	
	CtrConect(h_4,h_2,h_3);
	
	CtrCreat (h_1, 140, [9,233,272,64], "Active variable label");
	h_5 = CtrCreat (h_1, 510, [17,249,256,40], "");
	
	h_6 = CtrCreat (h_1, 140, [9,297,272,106], "Options");
	CtrCreat (h_1, 510, [41,316,144,16], "Prefix fo new variables:");
	h_7 = CtrCreat (h_1, 410, [185,313,56,20], "");
	CtrCreat (h_1, 130, [41,337,152,16], "Rewrite existing variables","rew=~rew;");
	CtrCreat (h_1, 130, [41,358,200,16], "Use original values in binary variabes","origv=~origv;");
	CtrCreat (h_1, 130, [41,379,200,16], "Use value labels for binarization","fromlabs=~fromlabs;");
	
	CtrCreat (h_1, 110, [ 97,411,56,24], "OK","check; if chi;WndClose(h_1);mul2bin(vars,pref,opts);end;");
	CtrCreat (h_1, 110, [161,411,56,24], "Cancel","WndClose(h_1)");
	CtrCreat (h_1, 110, [225,411,56,24], "Paste","check; if chi;paste;WndClose(h_1);end;");
else
	MsgBox([],"Morate prvo ucitati SPSS podatke");
end

global macro update
	vars = CtrGet(h_g,1);
	if size(vars,1)
		vars = ucase(vars);
		labVar=GetVarLabel(vars(1));
		CtrSet(h_5,labVar);
	end
end

global macro check
	chi = 0;
	vars = CtrGet(h_3);
	if ~size(vars,1)
		MsgBox(h_1,"Niste izabrali ni jednu varijablu!",1);
		return;
	end
	pref = CtrGet(h_7);
	if ~strlen(pref)
		MsgBox(h_1,"Niste naveli prefix za nove varijable!",1);
		return;
	end
	
	opts="";
	if rew
		opts = [opts;"rewrite"];
	end
	if origv
		opts = [opts;"origval"];
	end
	if fromlabs
		opts = [opts;"fromlabs"];
	end
	if size(opts,1)>1
		opts(1)=[];
	end
	
	chi = 1;
end

global macro paste
	str = "\n\n!mul2bin vars = ";
	for i=1:max(size(vars))
		str = str+" "+vars(i);
	end
	str = str+"/\n         prefix = " + pref;
	
	
	opts=[];
	if rew
		opts = [opts;"rewrite"];
	end
	if origv
		opts = [opts;"origval"];
	end
	if fromlabs
		opts = [opts;"fromlabs"];
	end
	if size(opts,1)>0
		str = str+"/\n         options =";
		for i=1:size(opts,1)
			str = str + sprintf(" %s", opts(i));
		end
	end
	
	str = str+" .";
	syntax(str);
end