I am working on converting a SAS code into R and since I am relatively new to SAS I am having trouble understanding the following code snippet -
proc expand data=A out=B;
by number beg_date;
id date;
convert alpha1=calpha1/transformout=(+1 cuprod -1);
convert alpha2=calpha2/transformout=(+1 cuprod -1);
convert alpha3=calpha3/transformout=(+1 cuprod -1);
run;
I understand expand is used for expanding time series data like from monthly to quaterly or contract them. But what are the by and id statements for? From referring to SAS Support, I believe that the BY statement is used to specify the variables so that the cumulative product is calculated for a group of that variable. As for the ID statement, I understand that it is a key to identify the observations.Can anyone tell me if my understanding is correct? Do I used the transform command in R for this purpose? I don't have SAS license so I cannot try this out on a sample data and understand the output. Similarly, I don't have a raw data set to work on.