<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic pick daily data at different condition in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/pick-daily-data-at-different-condition/m-p/65811#M18761</link>
    <description>CASE   we want write loop to pick data. Every day has many data we just simple the data as follow. &lt;BR /&gt;
 &lt;BR /&gt;
When DATE is 2008/1/2, find the minimum value of the absolute value of SETTLE PRICE minus STRIKE PRICE.&lt;BR /&gt;
Then, there are two data left, and that is what we need to buy. A CALL and a PUT (they both have the same EXDATE and STRIKE PRICE)&lt;BR /&gt;
&lt;BR /&gt;
1/3 we buy the call and put that strike price = 22.5&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Data data1;&lt;BR /&gt;
Input Date Exdate CP_FLAG Bid Ask Volum Strike_Price Settle_Price &lt;BR /&gt;
format date yymmdd10. exdate :yymmdd10. ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2008/1/2 2008/1/16 C 2.3 2.6 2000 27.0 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P 2.1 2.7 3000 27.0 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 C 2.4 2.5 5528 22.5 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P 1.1 1.2 5617 22.5 23.15&lt;BR /&gt;
Set an ASSET ACCOUNT (the value of the option we hold is the mid price of bid and ask)&lt;BR /&gt;
&lt;BR /&gt;
When date comes to 2008/1/3;we still have to find the minimum value of absolute value of SETTLE PRICE minus STRIKE PRICE.&lt;BR /&gt;
And the data we left are showed as follow:&lt;BR /&gt;
&lt;BR /&gt;
Datalines;&lt;BR /&gt;
2008/1/2 2008/1/16 C  2.47  2.5  528   22.5   23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P  1.10  1.2  617   22.5   23.15&lt;BR /&gt;
1008/1/3 2008/1/16 C  1,99  2.0  756   25.0   23.42&lt;BR /&gt;
2008/1/3 2008/1/16 P  2.99  3.0  654   25.0   23.42&lt;BR /&gt;
2008/1/3 2008/1/16 C  2.05  2.2  783   22.5   23.42&lt;BR /&gt;
2008/1/3 2008/1/16 P  1.20  1.2  150   22.5   23.42&lt;BR /&gt;
 &lt;BR /&gt;
Compared with the data left in 2008/1/2, on 1/3 we buy the call and put that strike price is 22.5&lt;BR /&gt;
because  &lt;BR /&gt;
Minimum ABS(strike price-settle price)= 22.5-13.42 not&lt;BR /&gt;
25-23.42&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: RemusWayne&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: RemusWayne

Message was edited by: RemusWayne</description>
    <pubDate>Fri, 13 May 2011 15:07:40 GMT</pubDate>
    <dc:creator>RemusWayne</dc:creator>
    <dc:date>2011-05-13T15:07:40Z</dc:date>
    <item>
      <title>pick daily data at different condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pick-daily-data-at-different-condition/m-p/65811#M18761</link>
      <description>CASE   we want write loop to pick data. Every day has many data we just simple the data as follow. &lt;BR /&gt;
 &lt;BR /&gt;
When DATE is 2008/1/2, find the minimum value of the absolute value of SETTLE PRICE minus STRIKE PRICE.&lt;BR /&gt;
Then, there are two data left, and that is what we need to buy. A CALL and a PUT (they both have the same EXDATE and STRIKE PRICE)&lt;BR /&gt;
&lt;BR /&gt;
1/3 we buy the call and put that strike price = 22.5&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Data data1;&lt;BR /&gt;
Input Date Exdate CP_FLAG Bid Ask Volum Strike_Price Settle_Price &lt;BR /&gt;
format date yymmdd10. exdate :yymmdd10. ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2008/1/2 2008/1/16 C 2.3 2.6 2000 27.0 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P 2.1 2.7 3000 27.0 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 C 2.4 2.5 5528 22.5 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P 1.1 1.2 5617 22.5 23.15&lt;BR /&gt;
Set an ASSET ACCOUNT (the value of the option we hold is the mid price of bid and ask)&lt;BR /&gt;
&lt;BR /&gt;
When date comes to 2008/1/3;we still have to find the minimum value of absolute value of SETTLE PRICE minus STRIKE PRICE.&lt;BR /&gt;
And the data we left are showed as follow:&lt;BR /&gt;
&lt;BR /&gt;
Datalines;&lt;BR /&gt;
2008/1/2 2008/1/16 C  2.47  2.5  528   22.5   23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P  1.10  1.2  617   22.5   23.15&lt;BR /&gt;
1008/1/3 2008/1/16 C  1,99  2.0  756   25.0   23.42&lt;BR /&gt;
2008/1/3 2008/1/16 P  2.99  3.0  654   25.0   23.42&lt;BR /&gt;
2008/1/3 2008/1/16 C  2.05  2.2  783   22.5   23.42&lt;BR /&gt;
2008/1/3 2008/1/16 P  1.20  1.2  150   22.5   23.42&lt;BR /&gt;
 &lt;BR /&gt;
Compared with the data left in 2008/1/2, on 1/3 we buy the call and put that strike price is 22.5&lt;BR /&gt;
because  &lt;BR /&gt;
Minimum ABS(strike price-settle price)= 22.5-13.42 not&lt;BR /&gt;
25-23.42&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: RemusWayne&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: RemusWayne

Message was edited by: RemusWayne</description>
      <pubDate>Fri, 13 May 2011 15:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pick-daily-data-at-different-condition/m-p/65811#M18761</guid>
      <dc:creator>RemusWayne</dc:creator>
      <dc:date>2011-05-13T15:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: pick daily data at different condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/pick-daily-data-at-different-condition/m-p/65812#M18762</link>
      <description>After spending ten minutes,Finally understand somewhat you post.&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;1008&lt;/B&gt;/1/3 2008/1/16 C &lt;B&gt;1,99&lt;/B&gt; 2.0 756 25.0 23.42 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Minimum ABS(strike price-settle price)= 22.5 &lt;B&gt;13.42&lt;/B&gt; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
You can use sql 's Cartestian Product to get it easily.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data data1;&lt;BR /&gt;
input Date : yymmdd10. Exdate : yymmdd10. CP_FLAG $  Bid Ask Volum Strike_Price Settle_Price ;&lt;BR /&gt;
format date yymmdd10. exdate :yymmdd10. ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2008/1/2 2008/1/16 C 2.3 2.6 2000 27.0 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P 2.1 2.7 3000 27.0 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 C 2.4 2.5 5528 22.5 23.15&lt;BR /&gt;
2008/1/2 2008/1/16 P 1.1 1.2 5617 22.5 23.15&lt;BR /&gt;
2008/1/3 2008/1/16 C 1.99 2.0 756 25.0 23.42&lt;BR /&gt;
2008/1/3 2008/1/16 P 2.99 3.0 654 25.0 23.42&lt;BR /&gt;
2008/1/3 2008/1/16 C 2.05 2.2 783 22.5 23.42&lt;BR /&gt;
2008/1/3 2008/1/16 P 1.20 1.2 150 22.5 23.42&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 create table want as&lt;BR /&gt;
  select *&lt;BR /&gt;
   from data1&lt;BR /&gt;
    group by date&lt;BR /&gt;
     having abs(strike_price-settle_price)=min(abs(strike_price-settle_price))&lt;BR /&gt;
    ;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
So weird , Why my post is always truncated.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Mon, 16 May 2011 07:34:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/pick-daily-data-at-different-condition/m-p/65812#M18762</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-16T07:34:30Z</dc:date>
    </item>
  </channel>
</rss>

