08-25-2011 05:02 AM
I have a list of unique observations that I want to assign a month to for several years
I want it to look like
2 Feb05 and so on.
Can anyone help with the most efficient way of doing this.
08-25-2011 05:58 AM
In the following program you need to set the start year and the end_year that you want to use:
data temp2(drop= j i);
do i=&start_year to &end_year;
do j=1 to 12;
format month mmyyn6.;
08-25-2011 09:39 AM
I see that others have already shown you how to build a series of consecutive monthly periods, but I have what I think is an equally pressing question: how do you know which date applies to which of your records?
08-25-2011 10:49 AM
For all of my observations I needed to create an extra row for each month since Jan05 with the obs against it; so each observation would appear 79 times (number of months since Jan05).
I have additional data at obs level but only appearing in certain months; but my customer wants to see all months even if the observation does not have a record against it.
With my original data now I can do a simple merge by obs & date to keep all obs for all months.
I had actually created what I required before posting, but it seemed such a convoluted solution, that I thought there must be an easier way; and there was!
Both options worked fine, but I went with the yonib's in the end.
Thanks to everyone who replied.