Appreciate if someone of you help me to convert below SAS code to R using SQLDF. I'm struggling to change the data type and apply sub string function in one single step.
Also In second step I'm not certain how to save the value of field in another new field which can be used in later stage.
proc sql;
create table noodle as
select MATRL_NBR,
put(PLANT, z4.) as PLANT_NBR,
PLANT_DESC,
MFG_DT,
input(substr(FISC_PD, 5, 4), best32.) as FISC_YR,
input(substr(FISC_PD, 1, 3), best32.) as FISC_PD,
input(substr(FISC_WK, 1, 3), best32.) as FISC_WK,
PLANNED_ZNL,
ACTUAL_ZNL,
CRIT_SKU,
IP_BRAND,
IP_BU,
CATG,
MATRL_TYPE
from comb
;
quit;
proc sql noprint;
select max(FISC_YR), max(FISC_WK)
into :CURRENT_FISC_YR, :CURRENT_FISC_WK
from noodle;
quit;