09-16-2014 02:21 AM
It are the first n obs of each group when processing in reversed order. For small data re-sorting is easy and quickest way.
09-16-2014 03:10 AM
please elaborate your limitations.
With an external RDBMS there is no physical order defined only logical ordering. In that case a question like this is humbug.
With streaming data you could define a queue of defined size. The lag function of SAS is looking like that. Also a hash can be used for that
Big data with SAS-datasets (relative to your machine) can be processed using a point but than you are losing the first/last options.
What to do if there are less than n records in a group?
09-16-2014 10:03 AM
No. On the contrary, I think you should share your solution with the forum. So should someone else have the similar issue, the answer becomes available.
09-17-2014 01:04 PM
To add, the double dow loop http://support.sas.com/resources/papers/proceedings09/038-2009.pdf looks to uses the merge by with a reset at the same position / group order.
In that case you have a generic approach for a sorted dataset.
Need further help from the community? Please ask a new question.