One month lag in daily data
Posted: Wed Mar 20, 2013 7:21 am
Hi,
I have a dataset containing stock quotes and interest rates on a daily basis (5days/week). I wish to calculate the 1month returns to these, and thus need to be able to lag the values of variable by 1 month (and not 30 days or something similar).
Is there any way to do this? I've tried applying a filter through defining a dummy, however lagging 1 period still gives the previous day's quote, not the -1month quote.
Since it's 5day/week data, it automatically needs to sort out the dating, ie. if I want the return in april, I need the first trading day of march (not 1st of march if its a weekend).
To define my dummy for if conditioning to only pick first available day of a month I've defined the following variable: series fd=@iif(@month<>@month(-1), 1, fd(-1)+1)
Best regards, Thomas
I have a dataset containing stock quotes and interest rates on a daily basis (5days/week). I wish to calculate the 1month returns to these, and thus need to be able to lag the values of variable by 1 month (and not 30 days or something similar).
Is there any way to do this? I've tried applying a filter through defining a dummy, however lagging 1 period still gives the previous day's quote, not the -1month quote.
Since it's 5day/week data, it automatically needs to sort out the dating, ie. if I want the return in april, I need the first trading day of march (not 1st of march if its a weekend).
To define my dummy for if conditioning to only pick first available day of a month I've defined the following variable: series fd=@iif(@month<>@month(-1), 1, fd(-1)+1)
Best regards, Thomas