* The idea illustrated in this syntax is powerful and, hence, frequently used. * The objective is to define two macros which will contain some numerical values previously obtained from the data. * When the macros are subsequently used, the relevant numerical values are obtained. * Raynald Levesque rlevesque@videotron.ca. SET MPRINT=ON. DATA LIST LIST /id(F8) var1(F8). BEGIN DATA. 1 10 1 15 1 10 2 20 2 25 3 15 3 25 END DATA. LIST. SAVE OUTFILE='c:\\temp\\data.sav'. COMPUTE break_v=(id=1). AGGREGATE /OUTFILE=* /BREAK=break_v /var1_1 = SUM(var1). DO IF break_v=1. WRITE OUTFILE 'c:\\temp\\temp.sps' /"DEFINE !sum_1()"/var1_1/"!ENDDEFINE.". ELSE. WRITE OUTFILE 'c:\\temp\\temp.sps' /"DEFINE !sum_tot()"/var1_1/"!ENDDEFINE.". END IF. EXE. GET FILE='c:\\temp\\data.sav'. INCLUDE 'c:\\temp\\temp.sps'. *Now use the macros. * the sole purpose of the following compute is to show that the method works. DO IF id=1. COMPUTE var2 =!sum_1. ELSE. COMPUTE var2 = !sum_1/(!sum_1 + !sum_tot). END IF. FORMATS var2(F8.3). EXECUTE.