Quartz | Level 8

## How to Calculate this steps

Hi community,

1.How to calculate the year which is 20 years from run date. E.g if today’s date is 11MAY2020, then this step will give year 2040.

2. Identify the collection which are linked with the strategies.

3.How to Calculate production for those collection from the historic production table for which the year value we get in step 1 in the date range in the collection name.

e.g  if collection name is " Flexi 2040-42 (BLK) " then this collection will be picked up and production needs to be calculated for this collection for the corresponding strategy.

If no such collection is found for any plan, populate 0 in the corresponding months production fields.

4. perf  Field of historic production table  will be the production for that collection.

example of historic production table,

Bag   Date          perf

BP1  30042015  -0.08091
BP2  31052015  1.14936
BP2  30062015  -5.51757
BP2  31072015  2.32196

example of strategy table

strategy     sc_no        uni_collection

1895_264  A00086  X001
1900_277  A00087 X065
1896_598  A00086  X474
2035_629  A00100  X095

example of collection table

uni_collection  Collection                   Bag

612Y                Idx (BLK)                   BP2
X474               cptl 2073-75 (BLK)     BY7
X001               Cptl 2040-42 (BLK)    BP1
017R               Cash 2016-2018        BP1

Edited

2 REPLIES 2
Meteorite | Level 14

## Re: How to Calculate this steps

You can retrieve the year which is 20 years from run date by using the INTNX function.
The modifier "S" tells SAS to pick the same date (-> so 11MAY2040).
For your other questions, could you please explain where do we find the collection name? For example, is Flexi 2040-42 (BLK) the name of the production dataset?
Best,
``````data have;
format today_date date9.;
today_date = today();
year20 = year(intnx('year',today_date,20,"s"));
run;``````

Quartz | Level 8

## Re: How to Calculate this steps

Thanks,
and sorry there is a missed link in the above question, I edited that now no. 2 point

Discussion stats
• 2 replies
• 348 views
• 1 like
• 2 in conversation