Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
pgdavis2
Partner - Creator
Partner - Creator

For next loop to populate a new field and use for calculations

I'm trying to step through some values and have them loaded as a new field to be used in an aggregation calculation:

I want a new field called StrikePrice to be populated with values 10-20, and have some calculated fields generated from it...

I am not having any luck so far with it...any ideas?

for strike=10 to 20

let $(strikeprice)=strike;

Concatenate LOAD Name1,Year,Month,Day,HE,

$(strikeprice) as StrikePrice,

avg(TotalLMP_DA)-avg(TotalLMP_RT) as DART_LMP_DELTA,

nummax(0,($(strikeprice)-avg([TotalLMP_DA]))/fabs($(strikeprice)-avg([TotalLMP_DA])))*(avg([TotalLMP_DA])-avg([TotalLMP_RT])) as DemandPL,

nummax(0,-1*($(strikeprice)-avg([TotalLMP_DA]))/fabs($(strikeprice)-avg([TotalLMP_DA])))*(avg([TotalLMP_RT])-avg([TotalLMP_DA])) as SupplyPL

RESIDENT Data

GROUP BY Name1,Year,Month,Day,HE

;

next strike;



1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Something along these lines (while loop instead of for loop):

LOAD Name1,Year,Month,Day,HE,iterno()+10 as StrikePrice
...
RESIDENT Data
GROUP BY Name1,Year,Month,Day,HE
WHILE iterno()<=11
;

View solution in original post

2 Replies
johnw
Champion III
Champion III

Something along these lines (while loop instead of for loop):

LOAD Name1,Year,Month,Day,HE,iterno()+10 as StrikePrice
...
RESIDENT Data
GROUP BY Name1,Year,Month,Day,HE
WHILE iterno()<=11
;

pgdavis2
Partner - Creator
Partner - Creator
Author

Thanks John - this is just what I needed!