<?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 What's the function of ID statement and ID variables in SAS/ETS procedures such as proc ssm? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/What-s-the-function-of-ID-statement-and-ID-variables-in-SAS-ETS/m-p/641052#M78304</link>
    <description>&lt;P&gt;ID statement with invterval=option are often used in many SAS/ETS procedures and the variable in ID statement is the same as that in interval= option in most cases, which makes me wonder what's the function of&amp;nbsp; ID statement and ID variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I give an example here to illustrate the question.&lt;/P&gt;&lt;P&gt;First generate data set yield containing date and the returns of five different terns&lt;/P&gt;&lt;P&gt;data yield;&lt;BR /&gt;input date yymmdd10. r1 r2 r3;&lt;BR /&gt;format date yymmdd10.;&lt;BR /&gt;datalines;&lt;BR /&gt;2006/1/6 1.46294753 1.545676434 1.9558192 2.162519237 2.194832429&lt;BR /&gt;2006/1/13 1.517894442 1.549327787 1.669094293 1.988184834 2.221032995&lt;BR /&gt;2006/1/20 1.443779686 1.510635118 1.723018 1.943191704 2.204235341&lt;BR /&gt;2006/2/10 1.435783602 1.688414215 1.69724586 2.151445183 2.201574693&lt;BR /&gt;2006/2/17 1.6281019 1.817423293 1.680777269 2.163502995 2.260976889&lt;BR /&gt;2006/2/24 1.829734545 1.777889515 1.775476292 2.231772981 2.452023801&lt;BR /&gt;2006/3/3 1.75221336 1.845058223 1.806409006 2.133990918 2.241448065&lt;BR /&gt;2006/3/10 1.313178054 1.487231308 1.843614505 2.162158776 2.202237333&lt;BR /&gt;2006/3/17 1.627393859 1.714023033 1.975522236 2.218210508 2.187701008&lt;BR /&gt;2006/3/24 1.619900094 1.728668273 2.214861743 2.357222001 2.3055817&lt;BR /&gt;2006/3/31 1.691377603 1.850381878 2.132324347 2.341794321 2.593702564&lt;BR /&gt;2006/4/7 1.231735136 1.807453577 2.164653658 2.410393618 2.388405978&lt;BR /&gt;2006/4/14 1.449047203 1.713296575 2.294770498 2.474280203 2.667311041&lt;BR /&gt;2006/4/21 1.480894013 1.629524198 2.285539957 2.533601373 2.524863995&lt;BR /&gt;2006/4/28 1.141625772 1.789791092 2.161464221 2.340933419 2.457365711&lt;BR /&gt;2006/5/12 1.307451441 1.81715313 2.038693946 2.267437591 2.394994933&lt;BR /&gt;2006/5/19 1.439636654 2.080794775 2.108766763 2.313459556 2.4577652&lt;BR /&gt;2006/5/26 1.674160206 1.765928425 2.25844977 2.528455213 2.693901836&lt;BR /&gt;2006/6/2 1.482448956 2.21148808 2.349679345 2.507319142 2.804667556&lt;BR /&gt;2006/6/9 1.752021548 2.28769497 2.728398265 2.783386524 2.89890221&lt;BR /&gt;2006/6/16 2.209143133 2.209143133 2.290172298 2.549907972 2.827645284&lt;BR /&gt;2006/6/23 2.192305499 2.192305499 2.538649928 2.817736518 2.893188672&lt;BR /&gt;2006/6/30 1.357508534 2.232876297 2.459028163 2.486074859 2.729804656&lt;BR /&gt;2006/7/7 1.378897552 2.119779823 2.491028121 2.548943541 2.750352417&lt;BR /&gt;2006/7/14 1.284483937 2.210362629 2.674652884 2.714931149 2.762746862&lt;BR /&gt;2006/7/21 1.904280164 1.972541129 2.582892905 2.544756038 2.729714013&lt;BR /&gt;2006/7/28 1.826223252 1.985150783 2.562360161 2.591627008 2.757583994&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Then employ proc ssm to estimate a state space model&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc ssm data=yield1 optimizer(technique=dbldog maxiter=600);&lt;BR /&gt;id date interval=month;&lt;BR /&gt;/*Observation equation white noise -- separate variance for each maturity */&lt;BR /&gt;parms lambda/ lower=1.e-4;&lt;BR /&gt;parms sigma1-sigma18 / lower=1.e-4;&lt;BR /&gt;array s_array(18) sigma1-sigma18;&lt;BR /&gt;do i=1 to 18;&lt;BR /&gt;if (type1=i) then sigma = s_array[i];&lt;BR /&gt;end;&lt;BR /&gt;irregular wn variance=sigma;&lt;BR /&gt;parms tsigma1-tsigma3/ lower=1.e-4;&lt;BR /&gt;/* Variables Z1, Z2, Z3 needed in the observation equation */&lt;BR /&gt;Z1= 1.0;&lt;BR /&gt;tmp = lambda*m;&lt;BR /&gt;Z2 = (1-exp(-tmp))/tmp;&lt;BR /&gt;Z3 = ( 1-exp(-tmp)-tmp*exp(-tmp) )/tmp;&lt;BR /&gt;/* Zero-mean VAR(1) factor gamma and the associated component */&lt;BR /&gt;state gamma(3) type=VARMA(p(d)=1) cov(g) print=(cov ar);&lt;BR /&gt;comp gammaComp = (Z1-Z3)*gamma;&lt;BR /&gt;/* Constant mean vector mu and the associated component */&lt;BR /&gt;state mu(3) type=rw;&lt;BR /&gt;comp muComp = (Z1-Z3)*mu;&lt;BR /&gt;/* Observation equation */&lt;BR /&gt;model y= muComp gammaComp wn;&lt;BR /&gt;/* Various components defined only for the output purposes */&lt;BR /&gt;eval yieldSurface = muComp + gammaComp;&lt;BR /&gt;comp gamma1 = gamma[1];&lt;BR /&gt;comp gamma2 = gamma[2];&lt;BR /&gt;comp gamma3 = gamma[3];&lt;BR /&gt;comp mu1 = mu[1];&lt;BR /&gt;comp mu2 = mu[2];&lt;BR /&gt;comp mu3 = mu[3];&lt;BR /&gt;comp z2Gamma = (Z2)*gamma[2];&lt;BR /&gt;comp z3Gamma = (Z3)*gamma[3];&lt;BR /&gt;comp z2Mu = (Z2)*mu[2];&lt;BR /&gt;comp z3Mu = (Z3)*mu[3];&lt;BR /&gt;eval beta1 = mu1 + gamma1;&lt;BR /&gt;eval beta2 = mu2 + gamma2;&lt;BR /&gt;eval beta3 = mu3 + gamma3;&lt;/P&gt;&lt;P&gt;eval shortTem = z2Gamma + z2Mu;&lt;BR /&gt;eval medTerm = z3Gamma + z3Mu;&lt;BR /&gt;/* output the component estimates and the forecasts */&lt;BR /&gt;output out=dnsFor pdv;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ID statement specified the year as ID variable but&amp;nbsp; month as interval variable in option.&amp;nbsp; Which&amp;nbsp; observations did proc ssm use in estimation?&amp;nbsp; all the observations or only the monthly data?&amp;nbsp; How did ID statement work?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Apr 2020 07:56:42 GMT</pubDate>
    <dc:creator>Steve1964</dc:creator>
    <dc:date>2020-04-19T07:56:42Z</dc:date>
    <item>
      <title>What's the function of ID statement and ID variables in SAS/ETS procedures such as proc ssm?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/What-s-the-function-of-ID-statement-and-ID-variables-in-SAS-ETS/m-p/641053#M78302</link>
      <description>&lt;P&gt;ID statement with invterval=option are often used in many SAS/ETS procedures and the variable in ID statement is the same as that in interval= option in most cases, which makes me wonder what's the function of&amp;nbsp; ID statement and ID variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I give an example here to illustrate the question.&lt;/P&gt;&lt;P&gt;First generate data set yield containing date and the returns of five different terns&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data yield;
input year yymmdd10. r1 r2 r3;
format year yymmdd10.;
datalines;
2006/1/6	1.46294753	1.545676434	1.9558192	2.162519237	2.194832429
2006/1/13	1.517894442	1.549327787	1.669094293	1.988184834	2.221032995
2006/1/20	1.443779686	1.510635118	1.723018	1.943191704	2.204235341
2006/2/10	1.435783602	1.688414215	1.69724586	2.151445183	2.201574693
2006/2/17	1.6281019	1.817423293	1.680777269	2.163502995	2.260976889
2006/2/24	1.829734545	1.777889515	1.775476292	2.231772981	2.452023801
2006/3/3	1.75221336	1.845058223	1.806409006	2.133990918	2.241448065
2006/3/10	1.313178054	1.487231308	1.843614505	2.162158776	2.202237333
2006/3/17	1.627393859	1.714023033	1.975522236	2.218210508	2.187701008
2006/3/24	1.619900094	1.728668273	2.214861743	2.357222001	2.3055817
2006/3/31	1.691377603	1.850381878	2.132324347	2.341794321	2.593702564
2006/4/7	1.231735136	1.807453577	2.164653658	2.410393618	2.388405978
2006/4/14	1.449047203	1.713296575	2.294770498	2.474280203	2.667311041
2006/4/21	1.480894013	1.629524198	2.285539957	2.533601373	2.524863995
2006/4/28	1.141625772	1.789791092	2.161464221	2.340933419	2.457365711
2006/5/12	1.307451441	1.81715313	2.038693946	2.267437591	2.394994933
2006/5/19	1.439636654	2.080794775	2.108766763	2.313459556	2.4577652
2006/5/26	1.674160206	1.765928425	2.25844977	2.528455213	2.693901836
2006/6/2	1.482448956	2.21148808	2.349679345	2.507319142	2.804667556
2006/6/9	1.752021548	2.28769497	2.728398265	2.783386524	2.89890221
2006/6/16	2.209143133	2.209143133	2.290172298	2.549907972	2.827645284
2006/6/23	2.192305499	2.192305499	2.538649928	2.817736518	2.893188672
2006/6/30	1.357508534	2.232876297	2.459028163	2.486074859	2.729804656
2006/7/7	1.378897552	2.119779823	2.491028121	2.548943541	2.750352417
2006/7/14	1.284483937	2.210362629	2.674652884	2.714931149	2.762746862
2006/7/21	1.904280164	1.972541129	2.582892905	2.544756038	2.729714013
2006/7/28	1.826223252	1.985150783	2.562360161	2.591627008	2.757583994
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then employ proc ssm to estimate a state space model. The following is the first part of that used:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ssm data=yield1 optimizer(technique=dbldog maxiter=600);
id date interval=month;
/*Observation equation white noise -- separate variance for each maturity */
parms lambda/ lower=1.e-4;
parms sigma1-sigma18 / lower=1.e-4;
array s_array(18) sigma1-sigma18;
do i=1 to 18;
if (type1=i) then sigma = s_array[i]; 
end;
irregular wn variance=sigma;
parms tsigma1-tsigma3/ lower=1.e-4; 
/* Variables Z1, Z2, Z3 needed in the observation equation */
Z1= 1.0;
tmp = lambda*m;
Z2 = (1-exp(-tmp))/tmp;
Z3 = ( 1-exp(-tmp)-tmp*exp(-tmp) )/tmp;
/* Zero-mean VAR(1) factor gamma and the associated component */
state gamma(3) type=VARMA(p(d)=1) cov(g) print=(cov ar);
comp gammaComp = (Z1-Z3)*gamma;
/* Constant mean vector mu and the associated component */
state mu(3) type=rw;
comp muComp = (Z1-Z3)*mu;
/* Observation equation */
model y= muComp gammaComp wn;
/* Various components defined only for the output purposes */
eval yieldSurface = muComp + gammaComp;
comp gamma1 = gamma[1];
comp gamma2 = gamma[2];
comp gamma3 = gamma[3];
comp mu1 = mu[1];
comp mu2 = mu[2];
comp mu3 = mu[3];
comp z2Gamma = (Z2)*gamma[2];
comp z3Gamma = (Z3)*gamma[3];
comp z2Mu = (Z2)*mu[2];
comp z3Mu = (Z3)*mu[3];
eval beta1 = mu1 + gamma1;
eval beta2 = mu2 + gamma2;
eval beta3 = mu3 + gamma3;

eval shortTem = z2Gamma + z2Mu;
eval medTerm = z3Gamma + z3Mu;
/* output the component estimates and the forecasts */
output out=dnsFor pdv;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;ID statement specified the year as ID variable but&amp;nbsp; month as interval variable in option.&amp;nbsp; Which&amp;nbsp; observations did proc ssm use in estimation?&amp;nbsp; all the observations or only the monthly data?&amp;nbsp; How did ID statement work?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 08:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/What-s-the-function-of-ID-statement-and-ID-variables-in-SAS-ETS/m-p/641053#M78302</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2020-04-19T08:17:25Z</dc:date>
    </item>
    <item>
      <title>What's the function of ID statement and ID variables in SAS/ETS procedures such as proc ssm?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/What-s-the-function-of-ID-statement-and-ID-variables-in-SAS-ETS/m-p/641052#M78304</link>
      <description>&lt;P&gt;ID statement with invterval=option are often used in many SAS/ETS procedures and the variable in ID statement is the same as that in interval= option in most cases, which makes me wonder what's the function of&amp;nbsp; ID statement and ID variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I give an example here to illustrate the question.&lt;/P&gt;&lt;P&gt;First generate data set yield containing date and the returns of five different terns&lt;/P&gt;&lt;P&gt;data yield;&lt;BR /&gt;input date yymmdd10. r1 r2 r3;&lt;BR /&gt;format date yymmdd10.;&lt;BR /&gt;datalines;&lt;BR /&gt;2006/1/6 1.46294753 1.545676434 1.9558192 2.162519237 2.194832429&lt;BR /&gt;2006/1/13 1.517894442 1.549327787 1.669094293 1.988184834 2.221032995&lt;BR /&gt;2006/1/20 1.443779686 1.510635118 1.723018 1.943191704 2.204235341&lt;BR /&gt;2006/2/10 1.435783602 1.688414215 1.69724586 2.151445183 2.201574693&lt;BR /&gt;2006/2/17 1.6281019 1.817423293 1.680777269 2.163502995 2.260976889&lt;BR /&gt;2006/2/24 1.829734545 1.777889515 1.775476292 2.231772981 2.452023801&lt;BR /&gt;2006/3/3 1.75221336 1.845058223 1.806409006 2.133990918 2.241448065&lt;BR /&gt;2006/3/10 1.313178054 1.487231308 1.843614505 2.162158776 2.202237333&lt;BR /&gt;2006/3/17 1.627393859 1.714023033 1.975522236 2.218210508 2.187701008&lt;BR /&gt;2006/3/24 1.619900094 1.728668273 2.214861743 2.357222001 2.3055817&lt;BR /&gt;2006/3/31 1.691377603 1.850381878 2.132324347 2.341794321 2.593702564&lt;BR /&gt;2006/4/7 1.231735136 1.807453577 2.164653658 2.410393618 2.388405978&lt;BR /&gt;2006/4/14 1.449047203 1.713296575 2.294770498 2.474280203 2.667311041&lt;BR /&gt;2006/4/21 1.480894013 1.629524198 2.285539957 2.533601373 2.524863995&lt;BR /&gt;2006/4/28 1.141625772 1.789791092 2.161464221 2.340933419 2.457365711&lt;BR /&gt;2006/5/12 1.307451441 1.81715313 2.038693946 2.267437591 2.394994933&lt;BR /&gt;2006/5/19 1.439636654 2.080794775 2.108766763 2.313459556 2.4577652&lt;BR /&gt;2006/5/26 1.674160206 1.765928425 2.25844977 2.528455213 2.693901836&lt;BR /&gt;2006/6/2 1.482448956 2.21148808 2.349679345 2.507319142 2.804667556&lt;BR /&gt;2006/6/9 1.752021548 2.28769497 2.728398265 2.783386524 2.89890221&lt;BR /&gt;2006/6/16 2.209143133 2.209143133 2.290172298 2.549907972 2.827645284&lt;BR /&gt;2006/6/23 2.192305499 2.192305499 2.538649928 2.817736518 2.893188672&lt;BR /&gt;2006/6/30 1.357508534 2.232876297 2.459028163 2.486074859 2.729804656&lt;BR /&gt;2006/7/7 1.378897552 2.119779823 2.491028121 2.548943541 2.750352417&lt;BR /&gt;2006/7/14 1.284483937 2.210362629 2.674652884 2.714931149 2.762746862&lt;BR /&gt;2006/7/21 1.904280164 1.972541129 2.582892905 2.544756038 2.729714013&lt;BR /&gt;2006/7/28 1.826223252 1.985150783 2.562360161 2.591627008 2.757583994&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Then employ proc ssm to estimate a state space model&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc ssm data=yield1 optimizer(technique=dbldog maxiter=600);&lt;BR /&gt;id date interval=month;&lt;BR /&gt;/*Observation equation white noise -- separate variance for each maturity */&lt;BR /&gt;parms lambda/ lower=1.e-4;&lt;BR /&gt;parms sigma1-sigma18 / lower=1.e-4;&lt;BR /&gt;array s_array(18) sigma1-sigma18;&lt;BR /&gt;do i=1 to 18;&lt;BR /&gt;if (type1=i) then sigma = s_array[i];&lt;BR /&gt;end;&lt;BR /&gt;irregular wn variance=sigma;&lt;BR /&gt;parms tsigma1-tsigma3/ lower=1.e-4;&lt;BR /&gt;/* Variables Z1, Z2, Z3 needed in the observation equation */&lt;BR /&gt;Z1= 1.0;&lt;BR /&gt;tmp = lambda*m;&lt;BR /&gt;Z2 = (1-exp(-tmp))/tmp;&lt;BR /&gt;Z3 = ( 1-exp(-tmp)-tmp*exp(-tmp) )/tmp;&lt;BR /&gt;/* Zero-mean VAR(1) factor gamma and the associated component */&lt;BR /&gt;state gamma(3) type=VARMA(p(d)=1) cov(g) print=(cov ar);&lt;BR /&gt;comp gammaComp = (Z1-Z3)*gamma;&lt;BR /&gt;/* Constant mean vector mu and the associated component */&lt;BR /&gt;state mu(3) type=rw;&lt;BR /&gt;comp muComp = (Z1-Z3)*mu;&lt;BR /&gt;/* Observation equation */&lt;BR /&gt;model y= muComp gammaComp wn;&lt;BR /&gt;/* Various components defined only for the output purposes */&lt;BR /&gt;eval yieldSurface = muComp + gammaComp;&lt;BR /&gt;comp gamma1 = gamma[1];&lt;BR /&gt;comp gamma2 = gamma[2];&lt;BR /&gt;comp gamma3 = gamma[3];&lt;BR /&gt;comp mu1 = mu[1];&lt;BR /&gt;comp mu2 = mu[2];&lt;BR /&gt;comp mu3 = mu[3];&lt;BR /&gt;comp z2Gamma = (Z2)*gamma[2];&lt;BR /&gt;comp z3Gamma = (Z3)*gamma[3];&lt;BR /&gt;comp z2Mu = (Z2)*mu[2];&lt;BR /&gt;comp z3Mu = (Z3)*mu[3];&lt;BR /&gt;eval beta1 = mu1 + gamma1;&lt;BR /&gt;eval beta2 = mu2 + gamma2;&lt;BR /&gt;eval beta3 = mu3 + gamma3;&lt;/P&gt;&lt;P&gt;eval shortTem = z2Gamma + z2Mu;&lt;BR /&gt;eval medTerm = z3Gamma + z3Mu;&lt;BR /&gt;/* output the component estimates and the forecasts */&lt;BR /&gt;output out=dnsFor pdv;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ID statement specified the year as ID variable but&amp;nbsp; month as interval variable in option.&amp;nbsp; Which&amp;nbsp; observations did proc ssm use in estimation?&amp;nbsp; all the observations or only the monthly data?&amp;nbsp; How did ID statement work?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 07:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/What-s-the-function-of-ID-statement-and-ID-variables-in-SAS-ETS/m-p/641052#M78304</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2020-04-19T07:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: What's the function of ID statement and ID variables in SAS/ETS procedures such as proc ssm?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/What-s-the-function-of-ID-statement-and-ID-variables-in-SAS-ETS/m-p/641054#M78303</link>
      <description>&lt;P&gt;Correction:&lt;/P&gt;&lt;P&gt;The first two lines of proc ssm should be&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ssm data=yield optimizer(technique=dbldog maxiter=600);
id year interval=month;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Apr 2020 08:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/What-s-the-function-of-ID-statement-and-ID-variables-in-SAS-ETS/m-p/641054#M78303</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2020-04-19T08:21:21Z</dc:date>
    </item>
  </channel>
</rss>

