0

I am working with a dataset as follows:

YearZero    YearOne    YearTwo    YearThree
10          2.5        2.5        5
0           0          0.625      0.625
0           0          0          0.15625
0           2.5        3.125      5.78125

I'm looking to make a new table which requires manipulation of the dataset above for example I'd be looking to do a new dataset where V(R,C)=(Row,Column) +-(R,C)

V(2,2)= (2,4)-(3,2) i.e V(2,2)= 2.5 - 0.625

I can't seem to find where to work with observations individually in SaS, if there a way to do so on a large scale.

The result I'm looking for is eventually a new table/dataset where the results are derived from the original dataset

YearZero    YearOne    YearTwo    YearThree
10          7.5        5          0
0           2.5        1.9        1.3
0           0          3.125      2.9
0           0          0          5.78

So I'm looking (for 2,3) 2.5-0.625=1.9 i.e in year two there was a newly issued 2.5 (represented by the 4th column) and then a maturing of 0.625 (represented by the 3rd column, 2nd row in the original dataset.

what I'm asking is why SAS/SQL makes it so difficult to work with multidimensional arrays for basic arithmetic.

The Maturity profile comes from a 3x3 matrix as displayed in the top right of the below in the data set - I have merged it in here.

The New issuance is a 1x3 - as merged in at the bottom line of the below matrix.

the initial volume (YearZero) is a 1x1 - an integer , as merged in for the top left.

78282219
  • 593
  • 5
  • 21
  • @parfait - Look forward to seeing your solution – 78282219 Feb 27 '18 at 15:15
  • You need to be using SAS/IML if you want to treat your data as a matrix and access each value. – Reeza Feb 27 '18 at 15:41
  • Unfortunately the end product has requested IML is not used, what a nightmare eh – 78282219 Feb 27 '18 at 16:18
  • No, I suspect you're making this more difficult than it actually is. What are the rules you're trying to implement. SAS is a different language, you need to use the most efficient SAS approach, not what may be the most efficient in a different language. – Reeza Feb 27 '18 at 16:20
  • 1
    Also, you can easily load those up into a temporary 4x4 array and access each element individually, but I still suspect that's an over complicated approach that may not scale well. http://documentation.sas.com/?docsetId=lrcon&docsetTarget=p0e7601ugjmfgan1vysixzg3a71j.htm&docsetVersion=9.4&locale=en – Reeza Feb 27 '18 at 16:31
  • So I have a dataset that represents the initial volume, maturity profile of the volume and the new volume – 78282219 Feb 27 '18 at 16:57
  • then i'm making a new dataset to represent the volume at the end of the year which is a formula of initial volume, maturing volume and new volume – 78282219 Feb 27 '18 at 16:58
  • 2
    Post that in your question and please explain what each row is and each column is and how you're doing the calculation. Which is initial, where do you find the maturity Profile, etc. – Reeza Feb 27 '18 at 17:02
  • 1
    I've settled on working with each year individually (each row), it's a lengthy process but i'll tidy it up with macros later. – 78282219 Feb 28 '18 at 07:48
  • Maybe if you numbered your rows by doing something like `rownum=_N_` in a datastep, you would find it easier to deal with. –  May 15 '18 at 17:08

0 Answers0