<?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 Re: about Interpolation and Extrapolation in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64209#M18252</link>
    <description>Hello BQK,&lt;BR /&gt;
&lt;BR /&gt;
This change to the code does the trick:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sort data=t out=t nodupkey;&lt;BR /&gt;
  by date TTM;&lt;BR /&gt;
run;&lt;BR /&gt;
proc expand data=t out=t1 (where=(exdate NE .)) METHOD=JOIN EXTRAPOLATE;&lt;BR /&gt;
  var rate;&lt;BR /&gt;
  id TTM;&lt;BR /&gt;
  by date;&lt;BR /&gt;
run;&lt;BR /&gt;
proc SQL;&lt;BR /&gt;
  create table data3 as select &lt;BR /&gt;
  a.*,b.rate&lt;BR /&gt;
  from data1 as a left join t1 as b &lt;BR /&gt;
  on a.date=b.date and a.TTM=b.TTM&lt;BR /&gt;
;quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
    <pubDate>Wed, 11 May 2011 14:37:12 GMT</pubDate>
    <dc:creator>SPR</dc:creator>
    <dc:date>2011-05-11T14:37:12Z</dc:date>
    <item>
      <title>about Interpolation and Extrapolation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64204#M18247</link>
      <description>i have 2 datasets, data1, data2.as following&lt;BR /&gt;
&lt;BR /&gt;
data data1;&lt;BR /&gt;
input date : yymmdd10. exdate:yymmdd10. TTM ;&lt;BR /&gt;
format date yymmdd10.  exdate :yymmdd10. ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2004/1/2	2004/1/17	15&lt;BR /&gt;
2004/1/2	2004/2/21	50&lt;BR /&gt;
2004/1/2	2004/3/20	78&lt;BR /&gt;
2004/1/5	2004/1/17	12&lt;BR /&gt;
2004/1/5	2004/2/21	47&lt;BR /&gt;
2004/1/5	2004/3/20	75&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data data2;&lt;BR /&gt;
input date : yymmdd10. days rate ;&lt;BR /&gt;
format date yymmdd10.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2004/1/2	19	1.11326&lt;BR /&gt;
2004/1/2	47	1.156422&lt;BR /&gt;
2004/1/2	75	1.178702&lt;BR /&gt;
2004/1/5	16	1.108422&lt;BR /&gt;
2004/1/5	44	1.154383&lt;BR /&gt;
2004/1/5	72	1.170505&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
i want to calculate the rate by linear Interpolation and linear Extrapolation  as following.&lt;BR /&gt;
&lt;BR /&gt;
data data3;&lt;BR /&gt;
input date : yymmdd10. exdate:yymmdd10. TTM rate ;&lt;BR /&gt;
format date yymmdd10.  exdate :yymmdd10. ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
date	exdate 	TTM	rate&lt;BR /&gt;
2004/1/2	2004/1/17	15	1.107094&lt;BR /&gt;
2004/1/2	2004/2/21	50	1.158809143&lt;BR /&gt;
2004/1/2	2004/3/20	78	1.181089143&lt;BR /&gt;
2004/1/5	2004/1/17	12	1.101856143&lt;BR /&gt;
2004/1/5	2004/2/21	47	1.156110357&lt;BR /&gt;
2004/1/5	2004/3/20	75	1.172232357&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
please help me, thx</description>
      <pubDate>Tue, 10 May 2011 09:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64204#M18247</guid>
      <dc:creator>bqk</dc:creator>
      <dc:date>2011-05-10T09:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: about Interpolation and Extrapolation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64205#M18248</link>
      <description>Hello BQK,&lt;BR /&gt;
&lt;BR /&gt;
I am not sure that understand you correctly but this is my solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data data1;&lt;BR /&gt;
  input date : yymmdd10. exdate:yymmdd10. TTM ;&lt;BR /&gt;
  format date yymmdd10. exdate :yymmdd10. ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2004/1/2 2004/1/17 15&lt;BR /&gt;
2004/1/2 2004/2/21 50&lt;BR /&gt;
2004/1/2 2004/3/20 78&lt;BR /&gt;
2004/1/5 2004/1/17 12&lt;BR /&gt;
2004/1/5 2004/2/21 47&lt;BR /&gt;
2004/1/5 2004/3/20 75&lt;BR /&gt;
run;&lt;BR /&gt;
data data2;&lt;BR /&gt;
  input date : yymmdd10. days rate ;&lt;BR /&gt;
  format date yymmdd10.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2004/1/2 19 1.11326&lt;BR /&gt;
2004/1/2 47 1.156422&lt;BR /&gt;
2004/1/2 75 1.178702&lt;BR /&gt;
2004/1/5 16 1.108422&lt;BR /&gt;
2004/1/5 44 1.154383&lt;BR /&gt;
2004/1/5 72 1.170505&lt;BR /&gt;
run;&lt;BR /&gt;
proc reg data=data2 outest=reg;&lt;BR /&gt;
  model rate=days;&lt;BR /&gt;
  by date;&lt;BR /&gt;
run;&lt;BR /&gt;
data data3;&lt;BR /&gt;
  retain date exdate TTM rate;&lt;BR /&gt;
  merge data1 reg (keep=date intercept days);&lt;BR /&gt;
  by date;&lt;BR /&gt;
  rate=intercept+days*TTM;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Tue, 10 May 2011 14:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64205#M18248</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-10T14:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: about Interpolation and Extrapolation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64206#M18249</link>
      <description>thank SPR!!!&lt;BR /&gt;
&lt;BR /&gt;
  i think you use the linear regression to calculate the Interpolation.&lt;BR /&gt;
&lt;BR /&gt;
  i think it is different with that i think at first.&lt;BR /&gt;
  &lt;BR /&gt;
   i calculate the interpolation by   &lt;BR /&gt;
(y-y_a)      (x-x_a)                                                &lt;BR /&gt;
--------  = ----------&lt;BR /&gt;
(y_b-y_a)   (x_b-x_a)&lt;BR /&gt;
 &lt;BR /&gt;
     and extrapolation by the same way.&lt;BR /&gt;
&lt;BR /&gt;
  in any case,  thanks SPR much~&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: bqk

Message was edited by: bqk</description>
      <pubDate>Tue, 10 May 2011 15:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64206#M18249</guid>
      <dc:creator>bqk</dc:creator>
      <dc:date>2011-05-10T15:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: about Interpolation and Extrapolation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64207#M18250</link>
      <description>OK, this is it:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data t;&lt;BR /&gt;
  set data1 data2(rename=(days=TTM));&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=t;&lt;BR /&gt;
  by date TTM;&lt;BR /&gt;
run;&lt;BR /&gt;
proc expand data=t out=data3 (where=(exdate NE .)) METHOD=JOIN EXTRAPOLATE;&lt;BR /&gt;
  var rate;&lt;BR /&gt;
  id TTM;&lt;BR /&gt;
  by date;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
However, instead of linear you can use spline interpolation (drop METJOD=JOIN), and I prefer of using regression...&lt;BR /&gt;
SPR</description>
      <pubDate>Tue, 10 May 2011 16:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64207#M18250</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-10T16:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: about Interpolation and Extrapolation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64208#M18251</link>
      <description>thank SPR much&lt;BR /&gt;
&lt;BR /&gt;
excuse me, could i ask another question?&lt;BR /&gt;
&lt;BR /&gt;
if i have another data1 as following&lt;BR /&gt;
&lt;BR /&gt;
data data1;&lt;BR /&gt;
input date : yymmdd10. exdate:yymmdd10. strike_price TTM ;&lt;BR /&gt;
format date yymmdd10. exdate :yymmdd10. ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2004/1/2	2004/1/17 1140 15&lt;BR /&gt;
2004/1/2	2004/1/17 1150 15&lt;BR /&gt;
2004/1/2	2004/2/21 1140 78&lt;BR /&gt;
2004/1/5	2004/1/17 1140 12&lt;BR /&gt;
2004/1/5	2004/1/17 1150 12&lt;BR /&gt;
2004/1/5	2004/2/21 1140 75&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
this data is different with the above becuse it has the same TTM &lt;BR /&gt;
&lt;BR /&gt;
please help me,thanx</description>
      <pubDate>Wed, 11 May 2011 03:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64208#M18251</guid>
      <dc:creator>bqk</dc:creator>
      <dc:date>2011-05-11T03:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: about Interpolation and Extrapolation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64209#M18252</link>
      <description>Hello BQK,&lt;BR /&gt;
&lt;BR /&gt;
This change to the code does the trick:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sort data=t out=t nodupkey;&lt;BR /&gt;
  by date TTM;&lt;BR /&gt;
run;&lt;BR /&gt;
proc expand data=t out=t1 (where=(exdate NE .)) METHOD=JOIN EXTRAPOLATE;&lt;BR /&gt;
  var rate;&lt;BR /&gt;
  id TTM;&lt;BR /&gt;
  by date;&lt;BR /&gt;
run;&lt;BR /&gt;
proc SQL;&lt;BR /&gt;
  create table data3 as select &lt;BR /&gt;
  a.*,b.rate&lt;BR /&gt;
  from data1 as a left join t1 as b &lt;BR /&gt;
  on a.date=b.date and a.TTM=b.TTM&lt;BR /&gt;
;quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Wed, 11 May 2011 14:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/about-Interpolation-and-Extrapolation/m-p/64209#M18252</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-11T14:37:12Z</dc:date>
    </item>
  </channel>
</rss>

