Home > Blockchain >  Understanding case statement in sas proc sql
Understanding case statement in sas proc sql

Time:11-24

I am having difficulty in understand this sas code.

select
      case    
       when DM_TURNOVER_TMP_STOCK."LIITM"n then   
        DM_TURNOVER_TMP_STOCK."LIITM"n     
      else   
        DM_TURNOVER_TMP_SALES."SDITM"n    
      end as "LIITM"n 
        
      case    
       when DM_TURNOVER_TMP_STOCK."LIMCU"n then   
        DM_TURNOVER_TMP_STOCK."LIMCU"n  

normally we use sas in sql in condition statment of column but here seems to be diffrent.Please help me in understanding this in postgres term.

CodePudding user response:

Assuming this is a query from tables DM_TURNOVER_TMP_STOCK and DM_TURNOVER_TMP_SALES,
when DM_TURNOVER_TMP_STOCK.LIITM is not missing and non zero, LIITM will get the value of DM_TURNOVER_TMP_STOCK.LIITM.
Otherwise, it will get the value of DM_TURNOVER_TMP_SALES.SDITM.

  • Related