<?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 lagged variable controlling for dates in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26822#M988</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV id="gmBabelFish" style="border: 1px solid black; display: none; position: absolute; background-color: #a8ecff; padding: 2px; font-size: 12px; color: black; text-align: left; z-index: 100;"&gt;&lt;DIV style="border-bottom: 1px dotted black; padding-bottom: 2px; padding-top: 2px;"&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: pointer;" title="Close babel mousish"&gt;x&lt;/SPAN&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: pointer;" title="Configure languange"&gt;c&lt;/SPAN&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: default;" title="From English To Italian"&gt;en &amp;gt; it&lt;/SPAN&gt;&lt;IMG align="middle" src="https://communities.sas.com/" style="border: medium none; cursor: pointer;" title="click to translate" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;through a better search I have found a previous post addressing the same problem: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://communities.sas.com/message/42101#42101"&gt;http://communities.sas.com/message/42101#42101&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I will look into it. however it seems the issue is resolved through a datastep solution. so maybe there is no lag function/statement that condition on the dates&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Oct 2011 13:27:11 GMT</pubDate>
    <dc:creator>ciro</dc:creator>
    <dc:date>2011-10-10T13:27:11Z</dc:date>
    <item>
      <title>lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26821#M987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV id="gmBabelFish" style="border: 1px solid black; display: none; position: absolute; background-color: #a8ecff; padding: 2px; font-size: 12px; color: black; text-align: left; z-index: 100;"&gt;&lt;DIV style="border-bottom: 1px dotted black; padding-bottom: 2px; padding-top: 2px;"&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: pointer;" title="Close babel mousish"&gt;x&lt;/SPAN&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: pointer;" title="Configure languange"&gt;c&lt;/SPAN&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: default;" title="From English To Italian"&gt;en &amp;gt; it&lt;/SPAN&gt;&lt;IMG align="middle" src="https://communities.sas.com/" style="border: medium none; cursor: pointer;" title="click to translate" /&gt;&lt;/DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;dear all, &lt;/P&gt;&lt;P&gt;I have a dataset with several monthly occurrences for each individual.&lt;/P&gt;&lt;P&gt;since I want to regress x(t) on x(t-1) and x(t-12) I have to create these lagged variables for each individual.&lt;/P&gt;&lt;P&gt;the code that I'am using is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=ds;&lt;/P&gt;&lt;P&gt;by code date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc panel data=ds;&lt;/P&gt;&lt;P&gt;id code date;&lt;/P&gt;&lt;P&gt;lag x(1 12) / out=ds1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I might use proc expand instead of proc panel)&lt;/P&gt;&lt;P&gt;however since there may be missing observations not for every individual the series is uninterrupted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for instance in the following example&amp;nbsp; for individual a&amp;nbsp; the months of january and july 2007 are missing. in this case I would like the lagged value for x is missing for february 2007 and august 2007&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code date x x_1 &lt;/P&gt;&lt;P&gt;a dec06 1 .&lt;/P&gt;&lt;P&gt;a feb07 2 .&lt;/P&gt;&lt;P&gt;a mar07 3 2&lt;/P&gt;&lt;P&gt;a apr07 4 3&lt;/P&gt;&lt;P&gt;a may07 5 4&lt;/P&gt;&lt;P&gt;a jun07 6 5&lt;/P&gt;&lt;P&gt;a aug07 7 .&lt;/P&gt;&lt;P&gt;a sep07 8 7&lt;/P&gt;&lt;P&gt;a oct07 9 8&lt;/P&gt;&lt;P&gt;a nov07 10 9&lt;/P&gt;&lt;P&gt;a dec07 11 10&lt;/P&gt;&lt;P&gt;a jan08 12 11&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the code above instead fills in the value with the previous observation within the same code regardless of the date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should I merge the data with the list of uninterrpted dates in a way to obtain beforehand the missing for the lacking observation or is there any way to get the results? &lt;/P&gt;&lt;P&gt;by the way I'm working with hundred of thousands of observation and proc panel takes a while to get the results, so I'm looking possibly for a more efficient solution.&lt;/P&gt;&lt;P&gt;I would appreciate any suggestions. thank you very much in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 09:43:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26821#M987</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2011-10-10T09:43:36Z</dc:date>
    </item>
    <item>
      <title>lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26822#M988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV id="gmBabelFish" style="border: 1px solid black; display: none; position: absolute; background-color: #a8ecff; padding: 2px; font-size: 12px; color: black; text-align: left; z-index: 100;"&gt;&lt;DIV style="border-bottom: 1px dotted black; padding-bottom: 2px; padding-top: 2px;"&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: pointer;" title="Close babel mousish"&gt;x&lt;/SPAN&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: pointer;" title="Configure languange"&gt;c&lt;/SPAN&gt;&lt;SPAN class="gmBabelMousishToolBar" style="cursor: default;" title="From English To Italian"&gt;en &amp;gt; it&lt;/SPAN&gt;&lt;IMG align="middle" src="https://communities.sas.com/" style="border: medium none; cursor: pointer;" title="click to translate" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;through a better search I have found a previous post addressing the same problem: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://communities.sas.com/message/42101#42101"&gt;http://communities.sas.com/message/42101#42101&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I will look into it. however it seems the issue is resolved through a datastep solution. so maybe there is no lag function/statement that condition on the dates&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 13:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26822#M988</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2011-10-10T13:27:11Z</dc:date>
    </item>
    <item>
      <title>lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26823#M989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data temp;
input code $ date : monyy7. x ;
format date date9.;
cards;
a dec06 1 
a feb07 2 
a mar07 3 
a apr07 4 
a may07 5 
a jun07 6
a aug07 7 
a sep07 8 
a oct07 9 
a nov07 10 
a dec07 11
a jan08 12
;
run;
data want;
 set temp;
 x_1=lag(x);
 if intck('month',lag(date),date) ne 1 then call missing(x_1);
 if code ne lag(code) then call missing(x_1);
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Oct 2011 03:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26823#M989</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-10-11T03:08:00Z</dc:date>
    </item>
    <item>
      <title>lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26824#M990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Ksharp, thank you very much.&amp;nbsp; I found your solution simple and elegant.&amp;nbsp; I liked a lot and it works well for lag 1.&lt;/P&gt;&lt;P&gt;Unfortunately this does not seem to solve the problem for lag 12 (or any other lag).&lt;/P&gt;&lt;P&gt;Consider the following:&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;input code $ date : monyy7. x ;&lt;/P&gt;&lt;P&gt;format date date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;a nov06 0 &lt;/P&gt;&lt;P&gt;a dec06 1 &lt;/P&gt;&lt;P&gt;a jan07 2&lt;/P&gt;&lt;P&gt;a feb07 3 &lt;/P&gt;&lt;P&gt;a mar07 4 &lt;/P&gt;&lt;P&gt;a apr07 5 &lt;/P&gt;&lt;P&gt;a may07 6 &lt;/P&gt;&lt;P&gt;a jun07 7&lt;/P&gt;&lt;P&gt;a jul07 8&lt;/P&gt;&lt;P&gt;a aug07 9 &lt;/P&gt;&lt;P&gt;a sep07 10 &lt;/P&gt;&lt;P&gt;a oct07 11 &lt;/P&gt;&lt;P&gt;a nov07 12 &lt;/P&gt;&lt;P&gt;a dec07 13&lt;/P&gt;&lt;P&gt;a jan08 14&lt;/P&gt;&lt;P&gt;b nov06 20 &lt;/P&gt;&lt;P&gt;b dec06 21 &lt;/P&gt;&lt;P&gt;b feb07 22 &lt;/P&gt;&lt;P&gt;b mar07 23 &lt;/P&gt;&lt;P&gt;b apr07 24 &lt;/P&gt;&lt;P&gt;b may07 25 &lt;/P&gt;&lt;P&gt;b jun07 26&lt;/P&gt;&lt;P&gt;b aug07 27 &lt;/P&gt;&lt;P&gt;b sep07 28 &lt;/P&gt;&lt;P&gt;b oct07 29 &lt;/P&gt;&lt;P&gt;b nov07 30 &lt;/P&gt;&lt;P&gt;b dec07 31&lt;/P&gt;&lt;P&gt;b jan08 32&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt; set temp;&lt;/P&gt;&lt;P&gt; x_1=lag(x);&lt;/P&gt;&lt;P&gt; if intck('month',lag(date),date) ne 1 then call missing(x_1);&lt;/P&gt;&lt;P&gt; if code ne lag(code) then call missing(x_1);&lt;/P&gt;&lt;P&gt; x_12=lag12(x);&lt;/P&gt;&lt;P&gt; if intck('month',lag12(date),date) ne 12 then call missing(x_12);&lt;/P&gt;&lt;P&gt; if code ne lag12(code) then call missing(x_12);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For code b where there are missing observations I don't get the value of x_12 for december 2007 although there exists an observation for december 2006. I imagine that I have to loop your code from lag12 to lag1 until I find the correct corresponding month, if there is one, but I don't know how to code it to get this result.&lt;/P&gt;&lt;P&gt;any suggestion?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 08:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26824#M990</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2011-10-20T08:46:33Z</dc:date>
    </item>
    <item>
      <title>lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26825#M991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two options that immediately come to mind are either building your own lag equivalents using retain, or preprocessing your data to fill in the missing dates.&amp;nbsp; I would go for the latter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lags are simply queues and your code doesn't take missing from the queue into account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How about something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data complete (keep=code date x);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set temp (rename=(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; date=in_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; x=in_x));&lt;/P&gt;&lt;P&gt;&amp;nbsp; by code;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain last_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.code then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date=in_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=in_x;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do i=1 to intck('month',last_date,in_date);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if i=intck('month',last_date,in_date) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date=in_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=in_x;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date=intnx('month',last_date,i,'sameday');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call missing(x);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; last_date=date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set complete;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x_1=lag(x);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intck('month',lag(date),date) ne 1 then call missing(x_1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if code ne lag(code) then call missing(x_1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; x_12=lag12(x);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intck('month',lag12(date),date) ne 12 then call missing(x_12);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if code ne lag12(code) then call missing(x_12);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 12:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26825#M991</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-20T12:57:46Z</dc:date>
    </item>
    <item>
      <title>lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26826#M992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;What you need is more like a querying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data temp;
input code $ date : monyy7. x ;
format date date9.;
cards;
a nov06 0
a dec06 1
a jan07 2
a feb07 3
a mar07 4
a apr07 5
a may07 6
a jun07 7
a jul07 8
a aug07 9
a sep07 10
a oct07 11
a nov07 12
a dec07 13
a jan08 14
b nov06 20
b dec06 21
b feb07 22
b mar07 23
b apr07 24
b may07 25
b jun07 26
b aug07 27
b sep07 28
b oct07 29
b nov07 30
b dec07 31
b jan08 32
;
run;

data want;
if _n_ eq 1 then do;
 if 0 then set temp(rename=(date=_date x=x_12));
 declare hash ha(hashexp : 10,dataset : 'temp(rename=(date=_date x=x_12))');
&amp;nbsp; ha.definekey('code','_date');
&amp;nbsp; ha.definedata('x_12');
&amp;nbsp; ha.definedone();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
set temp;
 _date=intnx('month',date,-12);
 rc=ha.find();
 if rc then call missing(x_12);
 drop _date rc;
run; 









&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2011 06:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26826#M992</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-10-21T06:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26827#M993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;expand&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; data=ds from=month method=none;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; code;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;id&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: red; font-family: 'Courier New'; background-color: white;"&gt;convert&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; x;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: red; font-family: 'Courier New'; background-color: white;"&gt;convert&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; x=x1 / transformout=(lag &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: red; font-family: 'Courier New'; background-color: white;"&gt;convert&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; x=x12 / transformout=(lag &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; code&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp; x1&amp;nbsp;&amp;nbsp;&amp;nbsp; x12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEC06&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JAN07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FEB07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAR07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; APR07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAY07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JUN07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JUL07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AUG07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SEP07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OCT07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NOV07&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt; 13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEC07&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JAN08&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2011 09:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26827#M993</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-10-21T09:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: lagged variable controlling for dates</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26828#M994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear data _null_, art297 and ksharp, thank you very much. all your solution works well. to be honest ksharp's hashing is beyond my current understanding.&lt;/P&gt;&lt;P&gt;For some reason I didn't see few days ago the answer of data _null_ and only now I learn that proc expand can manage my data situation. That maybe is the simplest solution although it might require more time to run on my data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2011 16:30:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/lagged-variable-controlling-for-dates/m-p/26828#M994</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2011-10-21T16:30:02Z</dc:date>
    </item>
  </channel>
</rss>

