@omer2020: you're not answering @Peter_C's question. He is asking whether you want a series of rolling 36-month windows, or just the most recent 36-month window.
Hi,
First I want to apologize for late response especially to @art297 @mkeintz @Peter_C. It was my first post on this forum and as english being my second language, I lack to fully explain my issue and understand ur helpful feedback cent percent.
What I was looking for, wasn't rolling window. My panel data has monthly observatons for each firms. First code remove all those firms having less than 36 observation, but it dont account for consectiveness.
proc sql;
create table mergeRET1 as select * from merge2
group by permno having count(ret) ge 36;
quit;
Adding these lines to macro code which I posted originally in first message do this:
if first.permno then count=1;
do i=count to 36; lagret[i] = .;
end;
count+1;
if lagret36 = . then delete;
This will remove all returns observations, for which 36th lagged value is missing. I was wrong to assume that this is reducing my data, as I was assuming that the right way is, to have all return observation for firms, having more than 36 observation (and there I confused most of you). The correct way is: regardless of firm observation count, any return value, current or past (lets say januany 2017) having previuos 36 months of data, (lets say previous monthly data is available back to january 2014) should be included. And if any single observation (montly return) is missing in last 36 months, then simply it should be dropped.
This above codes do exactly the same. But I realize that too lately. I tried to remove the post, since my question itself was flawed, but I wasn't able to find any option to remove my original post. And things respectful members have suggested, it was hard for me to understand and respond as starter. Still I find my behaviour very unprofessional and want to appologize for late reply.
I really want to thank @Peter_C @mkeintz @art297 for taking time to reply me back and trying best to help me out. I will try to be more clear and precise next time I will post something.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: