Run Macro with Different Sets of Parameters, Stored as Data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | *QUESTION: *What I want to do is create a file that contains parameters that I can use to create input files. *For instance, if everything was working correctly, I would be able to create 4 input files, each with the parameters identified on each of the rows in the data file below. *Therefore, the first input file would have 500 cases, a std. of 15, and nv = 5. *ANSWER posted to SPSSX-L by rlevesque@videotron.ca on 2001/05/21. * The following does what is reequired without creating separate parameter files. *////////////////////. DEFINE !test2 (numsubs=!TOKENS(1) /sd=!TOKENS(1) /nv=!TOKENS(1)) INPUT PROGRAM. VECTOR r(!nv,F8.2). LOOP id = 1 TO !numsubs. + LOOP #cnt=1 TO !nv. + COMPUTE r(#cnt) = RV.NORMAL(1,!sd). + END LOOP. END CASE. END LOOP. END FILE. END INPUT PROGRAM. EXECUTE. CORRELATIONS r1 TO !CONCAT(r,!nv) / STATISTICS=DESCRIPTIVES. !ENDDEFINE. *////////////////////. *----------------------------------------------. DATA LIST FREE / id(F8.0) numsubs(F8.0) sd(F8.2) nv(F8.0) . BEGIN DATA. 1.00 500.00 15.00 5.00 2.00 200.00 15.00 10.00 3.00 100.00 15.00 15.00 4.00 500.00 15.00 20.00 END DATA. EXECUTE. WRITE OUTFILE 'c:\\temp\\run macro.sps' /"!test2 numsubs="numsubs" sd="sd" nv="nv".". EXECUTE. INCLUDE FILE='c:\\temp\\run macro.sps'. |
Related pages
...