07-01-2014 07:52 PM
Typically cupa_dt is greater than start_dt. However, when start_dt is greater than cupa_dt I need to switch around start_dt and cupa_dt to get the correct difference between the two dates. Is there any way to accomplish this without creating a flag (ie cc_check)?
if (start_dt>cupa_dt and cupa_dt ne .) then cc_check=1;
if(cc_check=0) then do;
if(cc_check=1) then do;
07-02-2014 06:50 PM
although you have one solution, here is another
difference = range( date1, date2 ) ;
Here is some code to demo the result .
do date1 = today() - 3 to today()+2, . ;
do date2 = today() - 3 to today()+2, . ;
diff= range( date1,date2) ;
format date: date. ;