LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 1999, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 4 Nov 1999 17:57:30 GMT
Reply-To:   Patrice Bourdages <Union.Canadienne@RIQ.QC.CA>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Patrice Bourdages <Union.Canadienne@RIQ.QC.CA>
Organization:   L'Union Canadienne, cie d'assurances
Subject:   Re: Data manipulation problem
Content-Type:   text/plain; charset=us-ascii

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 ?


Back to: Top of message | Previous page | Main SAS-L page