BookmarkSubscribeRSS Feed
annypanny
Quartz | Level 8

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 

Thanks in advance

Edited

 

2 REPLIES 2
ed_sas_member
Meteorite | Level 14

Hi @annypanny 

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;

 

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



sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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