I am currently working on converting a SAS script to R. As I am relatively new to SAS, I am having a hard time understanding the following statement -
VARS=date id sales units
/* create lag event variable names to be used in the RETAIN statement */
%let vars_l = lag_%sysfunc(tranwrd(&vars,%str( ),%str( lag_)));
Here, date, id etc. are all variables present in my current data set. I understand the function tranwrd is used to replace a value by another value in a Character variable. In this case, it creates new items as -
vars_l = lag_date lag_id lag_sales lag_units
Am I right? What is vars_l? Is it a list? Or are these variables that are added to my dataset? Also what is the use of lag before %sysfunc in the code below for?
%let vars_l = lag_%sysfunc(tranwrd(&vars,%str( ),%str( lag_)));
Are lagged variables created at all or just variables with no values prefixed with lag_ is created?
I don't have access to SAS or the datasets to try and check the result. Any help on this would be great. Thanks!