Tracking different samples with if statement
Posted: Thu Mar 23, 2017 5:43 am
Hi there,
I wrote the following code to assign different values to matrix temp in different samples.
I would like some suggestions to simplify the if statement below:
Could I make the if statement simpler? Something like:
if %currsmpl = %sample1 then ...
I've tried different versions but to no avail:
if {%currsmpl} = {%sample1} then ...
if @eqna(%currsmpl,%sample1) then ...
Many thanks!
I wrote the following code to assign different values to matrix temp in different samples.
I would like some suggestions to simplify the if statement below:
Code: Select all
%sample1 = "1999q1 2001q4"
%sample2 = "2002q1 2004q4"
for %1 %2 {%sample1} {%sample2}
smpl {%1} {%2}
%currsmpl = @pagesmpl 'get current sample
string ss0 = @word(%currsmpl,1) 'only 1st element of sample is enough
string ss1 = @word(%sample1,1)
string ss2 = @word(%sample2,1)
if @eqna(%ss0,%ss1) then
matrix temp = mat01
else if @eqna(%ss0,%ss2) then
matrix temp = mat02
endif
endif
nextif %currsmpl = %sample1 then ...
I've tried different versions but to no avail:
if {%currsmpl} = {%sample1} then ...
if @eqna(%currsmpl,%sample1) then ...
Many thanks!