BookmarkSubscribeRSS Feed
subrat1
Fluorite | Level 6

 

I wanted to calculate holding period of mutual fund, If the quantity is sold in any month then the program should automatically create a new column called Holding period and  then calculate the difference of duration as shown in below table.

For example for mutual fund no :124, The current month quantity is 3000 and previous month was 4000 that means its sold in this month by 1000 unit.

But if the quantity is never sold like for mutual fund no :236 then it should give the duration from current month till first month.

Mutual FundQuantity_201904Quantity_201903Quantity_201902Quantity_201901Holding Period_1Holding Period_2
124300040001500200012
23640003000250050030
45670004000350080030
1 REPLY 1
Astounding
PROC Star

What if there are choices to be made?  For example:

 

January:  1000

February:  2000

March:  3000

April:  2000

 

The 1000 that were sold in April could come from any of the previous three months that were all purchases.  What should the holding period be?

 

What if the pattern looks like this:

 

January:   1000

February:  3000

March:  5000

April:  3500

May:  2000

 

What's the holding period for May, when the 1500 that were sold were purchased during more than one month?

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
  • 1 reply
  • 431 views
  • 1 like
  • 2 in conversation