Home > Software design >  How can i convert this SAS code in to SQL Query?
How can i convert this SAS code in to SQL Query?

Time:07-02

data GC_OUT.ABCD_2;
    set GC_OUT.TEST;
 
    index_first_non_zero = verify(ASSIGNED_EMPLOYEE_CD,"0");
    ASSIGNED_EMPLOYEE_CD_1 = substr(ASSIGNED_EMPLOYEE_CD, index_first_non_zero);
run;

CodePudding user response:

A direct translation would be something like this:

proc sql;
create table GC_OUT.ABCD_2 as 
  select *
       , verify(ASSIGNED_EMPLOYEE_CD,"0") as index_first_non_zero
       , substr(ASSIGNED_EMPLOYEE_CD,calculated index_first_non_zero) 
         as ASSIGNED_EMPLOYEE_CD_1
  from GC_OUT.TEST
;
quit;
  • Related