how to apply a small SAS loop in sql server from a select

32 Views Asked by At

do you have an idea of how to convert this SAS code into sql server from a select on the table ETUDE: this SAS code allows to add to each row of the table ETUDE in the column A data which varies from Age_FIN_REDR to Age_Debut (in the case of Type=V and after in the case of type=T). Table ETUDE contains 1814 rows and output ETUDE1 contains 139,427 rows FOR INFORMATION, COLUMN A does not exist in ETUDE, it must be added.

data ETUDE1;
    set ETUDE;
    if TYP_RTE='V' then do;
        do A=AGE_FIN_REDR to AGE_DEB by -1;
            output;
        end;
    end;
    else if TYP_RTE='T' then do;
        do A=AGE_FIN_REDR+1 to AGE_DEB by -1;
            output;
        end;
    end;
run;
0

There are 0 best solutions below