|
At 04:24 PM 7/1/2008, [hidden email] wrote, off list:
>Here is some more information on my problem. Each case is an hour >of a day, so in processing 6 months of data, we have approx. 24 X >180 = 4320 cases. There are 1500 nodes = the approx. number of >variables. Hr and forecastload are also variables. Processing the >data using the VECTOR command only, here is the crux of the problem >(omitting LEAVE statements, etc.). If your dataset has variables DAY, HOUR, forecastload, and 1500 NODE variables, I'd suggest AGGREGATE. Something like this (which - fair warning - *clobbers* the active data file). I don't think this is a weighted average, but I'm following your code as accurately as I can. TEMPORARY. LOOP #i = 1 TO 1500. . COMPUTE node(#i) =node(#i)/forecastload END LOOP. * > process days hr by hr to compute 20-day weighted . * > ave. for each node . AGGREGATE OUTFILE=* /BREAK=HOUR / weightedave1 TO weightedave1500 =SUM(node1 TO node1500). ===================================== APPENDIX: Test this form of AGGREGATE ===================================== |-----------------------------|---------------------------| |Output Created |02-JUL-2008 21:07:45 | |-----------------------------|---------------------------| BreakVar Instance Data1 Data2 Data3 1 1 1.87 1.17 1.27 1 2 1.17 2.81 3.61 1 3 3.03 2.92 3.88 2 1 3.01 3.26 1.58 2 2 3.01 2.22 1.20 2 3 2.57 2.69 3.02 3 1 2.64 3.33 2.68 3 2 3.03 2.15 2.40 3 3 2.53 3.60 3.67 Number of cases read: 9 Number of cases listed: 9 AGGREGATE OUTFILE=* /BREAK = BreakVar /Avg1 TO Avg3 = MEAN(Data1 TO Data3). LIST. List |-----------------------------|---------------------------| |Output Created |02-JUL-2008 21:08:45 | |-----------------------------|---------------------------| BreakVar Avg1 Avg2 Avg3 1 2.02 2.30 2.92 2 2.86 2.72 1.93 3 2.74 3.03 2.92 Number of cases read: 3 Number of cases listed: 3 ================== TEST DATA and code ================== NEW FILE. INPUT PROGRAM. . NUMERIC BreakVar Instance (F2) /Data1 TO Data3 (F8.2). . LEAVE BreakVar Instance. . VECTOR Value = Data1 TO Data3. . LOOP BreakVar = 1 TO 3. . LOOP Instance = 1 TO 3. . LOOP #i = 1 TO 3. . COMPUTE Value(#i) = RV.UNIFORM(1,4). . END LOOP. . END CASE. . END LOOP. . END LOOP. END FILE. END INPUT PROGRAM. LIST. AGGREGATE OUTFILE=* /BREAK = BreakVar /Avg1 TO Avg3 = MEAN(Data1 TO Data3). LIST. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
