|
Hello Noel,
I would try to bring the Dataset 1 into "shunks" of data looking like
the
following:
YYMM Qty
1967-01 22
1967-02 33
1967-03 25
...
Converting Dataset 2 to look like the following:
Start End Results
1967-01 1968-02
Then create a data step that would something like the following
(pseudo-code):
data _temp1;
create an array with all the values from Start to End;
create a "counter" variable;
start a loop from 1 to length of the array;
Lookup the value into Dataset 1;
Increment the counter with the sum of your counter and the
returned
value;
end;
Store the value into the Results variable;
end;
I'm typing this from home and I don't have SAS handy... But the basic is
there...
See ya, Patrice :-)
Noel O'Sullivan wrote:
> I have a large data set and am trying to do something similar to the
> problem below. Data set 1Obs Jan Feb Mar
> ..........1967 22 33 2519681969 .etc. Data set 2
> Start EndJan 1967 Feb 1968Feb 1968 Mar
> 1972................................................... My problem is
> to add up the relevant months in data set 1 to create the
> following New data set Start End TotalJan
> 1967 Feb 1968 xxx (i.e 22 + 33 + 25 ....)Feb 1968
> Mar 1972
> xxx................................................... Is there a way
> to this ?
|