Simpler way to maximize control variables?
Posted: Thu Mar 07, 2013 2:05 am
I have two control variables (containing date values) and I want to create a third control variable for the maximum of the two control variables. How do I do this? It should be really easy, but here I am, fiddling with matrices. Is there no simpler way than what I come up with below?
(For the sake of simplicity I have explicitly written the dates in question. In the program I am trying to write I, of course, do not know which of the two date values is the larger.)
Code: Select all
!D1=@dateval("2012Q2","YYYY[Q]Q")
!D2=@dateval("2012Q3","YYYY[Q]Q")
matrix(2,1) Ds
Ds.fill !D1, !D2
matrix mx=@cmax(Ds)
!Dmax=mx(1,1)
Delete Ds mx