function mul2mul(vars,prefix,options,nonvalue) 
	if def(vars)
		vars=ucase(vars);
	else
		error("Nije specificiran 'vars' argument")
	end
	if def(prefix)
		prefix=ucase(prefix);
	else
		error("Nije specificiran 'prefix' argument")
	end
	rewrite = 0;
	opt = "rewrite"; 
	if def(options); 
		options = lcase(options);
		for i=1:max(size(options))
			j = strlen(options(i));
			if j
				if (left(opt,j)==options(i))
					rewrite = 1;
				end
			end
		end
	end
	if def(nonvalue)
		if isstr(nonvalue)
			nonvalue = str2num(nonvalue(1));
		end
	else
		nonvalue = NaN;
	end
	
	ivars = max(size(vars));
	%check for existance of variables in data set
	greska = 0;
	for i=1:ivars
		newvar = strcat(prefix,num2str("%d",i));
		if strlen(newvar)>8
			printf("Predugacko ime za varijablu - %s; probajte sa kracim prefixom\n", newvar);
			greska = 1;
		end
		if ext(newvar)
			if ~rewrite
				printf("Varijabla %s postoji u fajlu\n", newvar);
				greska = 1;
			end
		else
			DataAddVar(newvar);
		end
		newvars(i) = newvar;
	end	
	if greska
		error ("Varijable postoje u fajlu, a niste naveli REWRITE opciju, ili je PREFIX predugacak!");
	end
	

	xmul = make(ncase,ivars,NaN);
%	for i=1:ncase
%		[val,y]=freq(Data(i,vars));
%		val1 = size(val,1);
%		if val(val1)==NaN
%			val(val1)=[];
%			y(val1)=[];
%			val1 = val1-1;
%		end
%		if val1>1 & nonvalue~=NaN
%			indx = find(val==nonvalue);
%			if indx~=[]
%				val(indx)=[];
%				y(indx)=[];
%				val1 = val1-1;
%			end
%		end
%		xmul(i,1:val1) = val';
%	end
	
	for i=1:ncase
		red = DataX(i,vars);
		[val,y]=freq(red);
		val1 = size(val,1);
		for j=1:val1
			indx = find(red==val(j));
			if max(size(indx))>1
				red(indx(2:Inf))=[];
			end
		end
		indx = find(red==NaN);
		if prod(size(indx))
%		prod(size(indx))
%		indx
%		red
			red(indx)=[];
		end
		
%		if val(val1)==NaN
%			val(val1)=[];
%			y(val1)=[];
%			val1 = val1-1;
%		end
%		if val1>1 & nonvalue~=NaN
%			indx = find(val==nonvalue);
%			if indx~=[]
%				val(indx)=[];
%				y(indx)=[];
%				val1 = val1-1;
%			end
%		end

		if size(red,2)>1 & nonvalue~=NaN
			indx = find(red==nonvalue);
			if prod(size(indx))
				red(indx)=[];
				if red==[]
					red = nonvalue;
				end
			end
		end
		if red~=[]
			xmul(i,1:size(red,2)) = red;
		end
	end
	
	varlab = GetVarLabel(vars);
	indx = find(~strlen(varlab));
	if indx~=[]
		varlab = varlab(indx(1));
	else
		varlab = "";
	end
	SetVarLabel(newvars,varlab);
	numval_=[];
	numlab_="";
	for i=1:ivars
		[numlab,numval] = GetNumLabel(vars(i));
		if size(numlab,1)
			indx = find(numlab~="");
		else
			indx =[];
		end
		if indx~=[]
			numval = numval(indx);
			numlab = numlab(indx);
		end
		numval_ = [numval_;numval];
		numlab_ = [numlab_;numlab];
	end
	[val,y]=freq(numval_);
	if val~=[]
		ival = size(val,1);
		for i=1:ival
			indx = find(numval_==val(i));
			SetNumLabel(newvars,val(i),numlab_(indx(1)+1));
		end
	end

	Data(:,newvars) = xmul;
	indx = find(~csum(xmul~=NaN));
	if indx~=[]
		newvarsD = newvars(indx);
		DataDelVar(newvarsD);
	else
		newvarsD = [];
	end
	
	printf("Kal successfully created %d new variables!\n",size(xmul,2)-max(size(newvarsD)));
	DataSave
end