```Date: Thu, 27 May 1999 17:36:35 +0200 Reply-To: Fabrizio_Arosio@ROTTA.COM Sender: "SPSSX(r) Discussion" From: Fabrizio Arosio Subject: Re: Help with macro Comments: To: MARIA_ELENA_GARCIA@WCJ.COM Content-type: text/plain; charset=us-ascii I don't know I the following syntax do what you need. Try it. set mexpand on. define calc (Case=!Tokens(1) /CVal=!Tokens(1)). !IF (!HEAD(!CASE) = 0 ) !THEN compute lead=data. !ELSE create lead=lead(data,!Case). !IFEND Compute tmp=tmp+lead*!CVal . !enddefine. define macro(!Positional !CmdEnd). compute tmp=0. !LET !TMP=!NULL !DO !I !IN (!1) calc Case= !LENGTH(!TMP) CVal= !I. !LET !TMP=!CONCAT(!TMP,"0") !DOEND compute result=lag(tmp). !enddefine. The main macro is called "macro" In your example you should call the the macro in the following way: macro 1 2 1.3 . Execute. Hope this helps, Fabrizio Maria Elena Garcia on 21/05/99 00.33.22 Please respond to MARIA_ELENA_GARCIA@WCJ.COM To: SPSSX-L@UGA.CC.UGA.EDU cc: (bcc: Fabrizio Arosio/RRL/IT) Subject: Help with macro Dear list: I need to make a macro and do not have the least idea of the way they work. Here I explain what I want the macro to do. I will really thank if anyone can suggest me anything. I want to give the macro k=2n+1 different numbers, then calculate the sum of the first k cases multipplied by the k numbers specified and assign this result to casenum=n. Then starting from casenum=2 compute the same count and assing it to casenum=n+1. The problem is that I do not know how to define the macro that reads k and the k numbers , and the way to specify the number that has to multipply. Example: convolution(K=3 ,numbers=(1, 2, 1.3) data v1 result 1 missing 5 1*1+5*2+8*1.3 8 5*1+8*2+7*1.3 7 8 *1+7*2+ 4*1.3 4 2 6 TIA, Maria Elena. ```

Back to: Top of message | Previous page | Main SPSSX-L page