Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
set V_Start=201907;
set V_Start_Month = 'if( V_Start=201907, 201905 , if( V_Start=201908, 201906 , if(V_Start=201909, 201905, 201904)))';
Hi All,
I have this code above where if there is a specific time period YYYYMM(201907) I want to display another time period e.g. 201905.
The code above I have created works fine, my concern is that the developer or analyst viewing this might have some trouble following. Can I use a if then else script to do the same as above? I have tried but the code starts erroring out with set and let logic wanting quotes etc..
Thanks in Advance!!
Rick
try like this..
set V_Start_Month = 'IF ( PICK(Match(V_Start,201907,201908,201909)+1,201904,201905,201906,201905)';
Thanks.
Vikky
try like this..
set V_Start_Month = 'IF ( PICK(Match(V_Start,201907,201908,201909)+1,201904,201905,201906,201905)';
Thanks.
Vikky
Thanks for the quick reply, is the +1 just pick the next number
For my purpose I used your solution with a minor change
set V_Start_Month = PICK(Match(V_Start,201907,201908,201909,201910),201906,201907,201908,201909);
Very cool, simple and elegant
Thanks
Rick
Welcome !
+1 is like similar to else condition of if-else in SQL.
Hope that helps.
Thanks.
Vikky