BookmarkSubscribeRSS Feed
bqk
Calcite | Level 5 bqk
Calcite | Level 5
i want to do the following step:

1. the shares holding is the delta

2. the shares purchased is the latter value minus the forward value
for example: on the 2004/1/5 the shares purchased 0.015666=-0.0153-(-0.03096)
However, the first value of shares purchase is equal to the shares holding

3. the first value of cumulative cost including interest equal to the value of shares purchased*SPX

4. the interest is the forward cumulative cost including interest*rate
for example, on the 2004/1/5 the cumulative cost including interest,
-0.37817=-34.3208*0.011019

5. the latter cumulative cost including interest equal to the sum of cost of shares purchased, forward cost of shares purchased, and interest.
for example: on the 2004/1/15, the cumulative cost including interest,
-17.1182=17.5807+(-34.3208)+(-0.37817)

6. if the OTM on the last trading day is bigger than 0.12, the cumulative cost including interest must minus the K
for example on the 2004/2/19, optionid is 21278521 cumulative cost including interest is -1.36945-(-990)=988.6305

the following is the data, data1 is the ordinary, data1 after the above steps is the data2.

please help me, thx~

data data1;
input Date yymmdd10. SPX optionid K delta rate OTM;
format date:yymmdd10.;
datalines;
2004/1/2 1108.48 21213832 990 -0.030962 0.01107094 0.002374423
2004/1/5 1122.22 21213832 990 -0.015296 0.011018561 0.013364581
2004/1/6 1123.67 21213832 990 -0.013465 0.01098864 0.014508708
2004/1/7 1126.33 21213832 990 -0.009658 0.01092533 0.016599931
2004/1/8 1131.92 21213832 990 -0.009319 0.010853256 0.020962612
2004/1/9 1121.86 21213832 990 -0.008953 0.0108289 0.013080064
2004/1/12 1127.23 21213832 990 -0.004376 0.010809861 0.017305253
2004/1/13 1121.22 21213832 990 -0.005754 0.010954211 0.012573804
2004/1/14 1130.52 21213832 990 0 0.010925194 0.01987404
2004/1/15 1132.05 21213832 990 0 0.010892781 0.021063557
2004/2/6 1142.76 21266383 990 -0.013135 0.010861995 1.78E-06
2004/2/9 1139.81 21266383 990 -0.007781 0.010911943 0.001159593
2004/2/10 1145.54 21266383 990 -0.012066 0.01095 0.003282342
2004/2/11 1157.76 21266383 990 -0.005021 0.010980483 0.007710792
2004/2/12 1152.11 21266383 990 -0.01159 0.010910774 0.000290589
2004/2/13 1145.81 21266383 990 -0.007482 0.010911757 0.003998297
2004/2/17 1156.99 21266383 990 -0.003989 0.010849384 0.000804481
2004/2/18 1151.82 21266383 990 -0.010775 0.010821329 0.00660581
2004/2/19 1147.06 21266383 990 0 0.010818377 0.007813259
2004/2/6 1142.76 21278521 990 -0.015639 0.010861995 0.01390295
2004/2/9 1139.81 21278521 990 -0.014962 0.010911943 0.013078146
2004/2/10 1145.54 21278521 990 -0.014319 0.01095 0.019917743
2004/2/11 1157.76 21278521 990 -0.014036 0.010980483 0.017086561
2004/2/12 1152.11 21278521 990 -0.01365 0.010910774 0.015238054
2004/2/13 1145.81 21278521 990 -0.01899 0.010911757 0.025821166
2004/2/17 1156.99 21278521 990 -0.012253 0.010849384 0.017171452
2004/2/18 1151.82 21278521 990 -0.012702 0.010821329 0.004990784
2004/2/19 1147.06 21278521 990 0 0.010818377 0.12
;

run;

data data2;
input Date yymmdd10. SPX optionid K delta rate OTM shares_holding shares_purchaded cost_of_shares_purchased cumulative_cost_interest interest
;
format date:yymmdd10.;
datalines;
2004/1/2 1108.48 21213832 990 -0.030962 0.01107094 0.002374423 -0.030962 -0.030962 -34.32075776 -34.32075776 .
2004/1/5 1122.22 21213832 990 -0.015296 0.011018561 0.013364581 -0.015296 0.015666 17.58069852 -17.11822462 -0.378165378
2004/1/6 1123.67 21213832 990 -0.013465 0.01098864 0.014508708 -0.013465 0.001831 2.05743977 -15.24889086 -0.188106008
2004/1/7 1126.33 21213832 990 -0.009658 0.01092533 0.016599931 -0.009658 0.003807 4.28793831 -11.12755171 -0.166599165
2004/1/8 1131.92 21213832 990 -0.009319 0.010853256 0.020962612 -0.009319 0.000339 0.38372088 -10.86460099 -0.120770164
2004/1/9 1121.86 21213832 990 -0.008953 0.0108289 0.013080064 -0.008953 0.000366 0.41060076 -10.57165191 -0.117651678
2004/1/12 1127.23 21213832 990 -0.004376 0.010809861 0.017305253 -0.004376 0.004577 5.15933171 -5.526598294 -0.114278092
2004/1/13 1121.22 21213832 990 -0.005754 0.010954211 0.012573804 -0.005754 -0.001378 -1.54504116 -7.13217898 -0.060539526
2004/1/14 1130.52 21213832 990 0 0.010925194 0.01987404 0 0.005754 6.50501208 -0.705087342 -0.077920441
2004/1/15 1132.05 21213832 990 0 0.010892781 0.021063557 0 0 0 -0.712767704 -0.007680362
2004/2/6 1142.76 21266383 990 -0.013135 0.010861995 1.78E-06 -0.013135 -0.013135 -15.0101526 -15.0101526 .
2004/2/9 1139.81 21266383 990 -0.007781 0.010911943 0.001159593 -0.007781 0.005354 6.10254274 -9.071399793 -0.163789933
2004/2/10 1145.54 21266383 990 -0.012066 0.01095 0.003282342 -0.012066 -0.004285 -4.9086389 -14.07937052 -0.099331828
2004/2/11 1157.76 21266383 990 -0.005021 0.010980483 0.007710792 -0.005021 0.007045 8.1564192 -6.077549607 -0.154598287
2004/2/12 1152.11 21266383 990 -0.01159 0.010910774 0.000290589 -0.01159 -0.006569 -7.56821059 -13.71207097 -0.066310772
2004/2/13 1145.81 21266383 990 -0.007482 0.010911757 0.003998297 -0.007482 0.004108 4.70698748 -9.154706277 -0.149622788
2004/2/17 1156.99 21266383 990 -0.003989 0.010849384 0.000804481 -0.003989 0.003493 4.04136607 -5.212663134 -0.099322926
2004/2/18 1151.82 21266383 990 -0.010775 0.010821329 0.00660581 -0.010775 -0.006786 -7.81625052 -13.08532159 -0.056407941
2004/2/19 1147.06 21266383 990 0 0.010818377 0.007813259 0 0.010775 12.3595715 -0.867312038 -0.141561944
2004/2/6 1142.76 21278521 990 -0.015639 0.010861995 0.01390295 -0.015639 -0.015639 -17.87162364 -17.87162364 .
2004/2/9 1139.81 21278521 990 -0.014962 0.010911943 0.013078146 -0.014962 0.000677 0.77165137 -17.29498641 -0.195014142
2004/2/10 1145.54 21278521 990 -0.014319 0.01095 0.019917743 -0.014319 0.000643 0.73658222 -16.74778429 -0.189380101
2004/2/11 1157.76 21278521 990 -0.014036 0.010980483 0.017086561 -0.014036 0.000283 0.32764608 -16.60403697 -0.183898758
2004/2/12 1152.11 21278521 990 -0.01365 0.010910774 0.015238054 -0.01365 0.000386 0.44471446 -16.34048541 -0.1811629
2004/2/13 1145.81 21278521 990 -0.01899 0.010911757 0.025821166 -0.01899 -0.00534 -6.1186254 -22.63741422 -0.178303408
2004/2/17 1156.99 21278521 990 -0.012253 0.010849384 0.017171452 -0.012253 0.006737 7.79464163 -15.0883746 -0.245602006
2004/2/18 1151.82 21278521 990 -0.012702 0.010821329 0.004990784 -0.012702 -0.000449 -0.51716718 -15.76881804 -0.163276259
2004/2/19 1147.06 21278521 990 0 0.010818377 0.12 0 0.012702 14.56995612 988.6305451 -0.170593021

run;
4 REPLIES 4
Wanderer
Calcite | Level 5
which industry role do u work dude
bqk
Calcite | Level 5 bqk
Calcite | Level 5
excuse me, i can not understand what you mean.
could you explain the question in detail?

Message was edited by: bqk Message was edited by: bqk
bqk
Calcite | Level 5 bqk
Calcite | Level 5
could anyone help me?
the main question is the 5 step
i do not how to solve it.
mick_g
Calcite | Level 5
have you try a do statement?
let x= shares purchase
y = shares holding
a = forward value
b = latter value
c= forward cumulative cost
d= interest
e= interest rate
z = latter cumulative cost

if criteria statement then do;
y = b - a;
d= x*d;
c= x + d;
z=x+d+forward cost of shares purchased;
end;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 988 views
  • 0 likes
  • 3 in conversation