<?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: LOCF in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395307#M95303</link>
    <description>&lt;P&gt;Still exactly the same logic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;input id month sales sales2;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 1200 500&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 1500&amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 1000 300&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;retain _sales __sales;&lt;/P&gt;&lt;P&gt;if first.id then call missing(_sales,__sales);&lt;/P&gt;&lt;P&gt;if sales then _sales=sales;&lt;/P&gt;&lt;P&gt;if sales2 then __sales=sales2;&lt;/P&gt;&lt;P&gt;drop sales sales2;&lt;/P&gt;&lt;P&gt;rename _sales=sales __sales=sales2;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2017 21:03:30 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2017-09-12T21:03:30Z</dc:date>
    <item>
      <title>LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395277#M95280</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following dataset:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HAVE&lt;/P&gt;&lt;P&gt;id month sales sales2&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 1 &amp;nbsp; 1200 500&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 2 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 3 &amp;nbsp; 1500 &amp;nbsp;.&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 4 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 1 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 2 &amp;nbsp; 1000 300&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 3 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 4 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WANT&lt;/P&gt;&lt;P&gt;id month sales sales2&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 1 &amp;nbsp; 1200 500&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 2 &amp;nbsp; 1200 500&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 3 &amp;nbsp; 1500 500&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 4 &amp;nbsp; 1500 500&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 1 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 2 &amp;nbsp; 1000 300&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 3 &amp;nbsp; 1000 300&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 4 &amp;nbsp; 1000 300&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I go about coding this? &amp;nbsp;Ideally I want the missing for id=2 to be filled in as well, but does that violate LOCF?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 21:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395277#M95280</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T21:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395280#M95281</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;input id sales;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1200&lt;BR /&gt;1 .&lt;BR /&gt;1 1500&lt;BR /&gt;1 .&lt;BR /&gt;2 .&lt;BR /&gt;2 1000&lt;BR /&gt;2 .&lt;BR /&gt;2 .&lt;BR /&gt;2 .&lt;BR /&gt;2 .&lt;BR /&gt;2 3000&lt;BR /&gt;3 .&lt;BR /&gt;3 .&lt;BR /&gt;3 1100&lt;BR /&gt;3 .&lt;BR /&gt;3 .&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;by id;&lt;BR /&gt;retain _sales;&lt;BR /&gt;if first.id then call missing(_sales);&lt;BR /&gt;if sales then _sales=sales;&lt;BR /&gt;drop sales;&lt;BR /&gt;rename _sales=sales;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395280#M95281</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T20:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395286#M95284</link>
      <description>&lt;P&gt;If you want to accomplish it directly during input, use a lag for id. e.g.:&lt;/P&gt;
&lt;PRE&gt;data HAVE (drop=hold);
  input id month sales;
  retain hold;
  if id ne lag(id) then hold=sales;
  else if not missing(sales) then hold=sales;
  else sales=hold;
  cards;
1   1   1200
1   2   .
1   3   1500
1   4   .
2   1   . 
2   2   1000
2   3   .
2   4   .
2   5   .
2   6   .
2   7   3000
3   1   .
3   2   .
3   3   1100
3   4   .
3   5   .
;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395286#M95284</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-09-12T20:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395287#M95285</link>
      <description>&lt;P&gt;I think that does the trick!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How does that differ from this code that I used?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;data want;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;set have;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;by id;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;retain _sales;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;if first.id then _sales=.;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;if sales~=. then sales=_sales;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;if last.id;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;run;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000"&gt;What is the purpose of the 'call missing' and retain keywords?&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395287#M95285</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T20:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395288#M95286</link>
      <description>&lt;P&gt;Call missing: &amp;nbsp; To avoid retaining the value from the previous by group&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And retain: To hold the value across obs coz values created by assignment statement are reset to missing during each interation of the datastep&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395288#M95286</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T20:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395289#M95287</link>
      <description>so in essence it is the same as 'if first.id then_sales=.;' that I used?</description>
      <pubDate>Tue, 12 Sep 2017 20:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395289#M95287</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T20:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395291#M95289</link>
      <description>&lt;P&gt;Thanks both for the quick replies. &amp;nbsp;Would it be possible to do this for multiple variables at a time or does it have to be done individually?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395291#M95289</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T20:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395292#M95290</link>
      <description>&lt;P&gt;Sorry, what do you mean? Can you please clarify. I am little too slow to read between the lines&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395292#M95290</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T20:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395295#M95292</link>
      <description>&lt;P&gt;Basically I was saying that your call missing line is equivalent to '&lt;SPAN&gt;if first.id then _sales=.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also do not understand why when I put 'if last.id;' that, that removes all of my observations for each id and leaves only one observation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I was also wondering if you can do this same process for multiple variables at a time instead of individually?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395295#M95292</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T20:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395296#M95293</link>
      <description>&lt;P&gt;Yes sorry. Your -&lt;SPAN&gt;call missing line is equivalent to '&lt;/SPAN&gt;&lt;SPAN&gt;if first.id then _sales=.; is right and absolute&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;also do not understand why when I put 'if last.id;' that, that removes all of my observations for each id and leaves only one observation.-- You don't need this subsetting if as you want to process and keep all obs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I was also wondering if you can do this same process for multiple variables at a time instead of individually?-- Yes, I think so if i understand you well enough.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395296#M95293</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T20:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395298#M95295</link>
      <description>&lt;P&gt;How would I do it for multiple variables at a time? &amp;nbsp;Can you give eaxample?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395298#M95295</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T20:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395301#M95297</link>
      <description>&lt;P&gt;Ok, if i understand what you mean, you may have multiple by groups. This could be a cascading or like a parent child group-sub group relationship. You just process by groups using first and last automatic vars from the child to the outer most by group.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am too lazy to write a program to show you a working example. May i request you to modify your req with what you have in mind in the question and I can work on the solution&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do apologise&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395301#M95297</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T20:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395305#M95301</link>
      <description>&lt;P&gt;Still no change sir:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;input id month sales;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 1200&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 1500&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 1000&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 3000&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 1100&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;retain _sales;&lt;/P&gt;&lt;P&gt;if first.id then call missing(_sales);&lt;/P&gt;&lt;P&gt;if sales then _sales=sales;&lt;/P&gt;&lt;P&gt;drop sales;&lt;/P&gt;&lt;P&gt;rename _sales=sales;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:57:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395305#M95301</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T20:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395306#M95302</link>
      <description>&lt;P&gt;I edited the original.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 20:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395306#M95302</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T20:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395307#M95303</link>
      <description>&lt;P&gt;Still exactly the same logic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;input id month sales sales2;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 1200 500&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 1500&amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 1000 300&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;retain _sales __sales;&lt;/P&gt;&lt;P&gt;if first.id then call missing(_sales,__sales);&lt;/P&gt;&lt;P&gt;if sales then _sales=sales;&lt;/P&gt;&lt;P&gt;if sales2 then __sales=sales2;&lt;/P&gt;&lt;P&gt;drop sales sales2;&lt;/P&gt;&lt;P&gt;rename _sales=sales __sales=sales2;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 21:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395307#M95303</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T21:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395308#M95304</link>
      <description>&lt;P&gt;And basically that logic can be applied to an 'infinite' number of variables in the same datastep?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 21:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395308#M95304</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T21:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395310#M95305</link>
      <description>&lt;P&gt;Well if it's too many(variables), then lazy people like me would have to find a way to shorten the typing. You would have noticed I had to type in another variable.Then it goes to arrays, hashes etc. The fun about sas is that harder the concept as it may seem (eg hashes) the easier is to process &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Have fun! I am leaving for my lectures at the university.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feel to free to open a new thread with a new question. Cheers!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 21:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395310#M95305</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T21:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395315#M95306</link>
      <description>&lt;P&gt;HAVE&lt;/P&gt;&lt;P&gt;id month sales&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 1 &amp;nbsp; 1200&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 2 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 3 &amp;nbsp; 1500 &amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 4 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 1 &amp;nbsp; 1000&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 2 &amp;nbsp; 1000&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 3 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 4 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WANT&lt;/P&gt;&lt;P&gt;id month sales&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 1 &amp;nbsp; 1200&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 2 &amp;nbsp; 1200&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 3 &amp;nbsp; 1500&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; 4 &amp;nbsp; 1500&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 1 &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 2 &amp;nbsp; 1000&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 3 &amp;nbsp; 1000&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; 4 &amp;nbsp; 1000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Novo - the code that you suggested seems to work for the most part. &amp;nbsp;It looks like theres an error though because sales2/id 2 is supposed to be 1000, but it shows up as missing?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 21:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395315#M95306</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T21:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395316#M95307</link>
      <description>&lt;P&gt;still not a single change in my code yet again:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input id month sales sales2;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1 1200 500&lt;BR /&gt;1 2 . .&lt;BR /&gt;1 3 1500 .&lt;BR /&gt;1 4 . .&lt;BR /&gt;2 1 1000 1000&lt;BR /&gt;2 2 1000 300&lt;BR /&gt;2 3 . .&lt;BR /&gt;2 4 . .&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;by id;&lt;BR /&gt;retain _sales __sales;&lt;BR /&gt;if first.id then call missing(_sales,__sales);&lt;BR /&gt;if sales then _sales=sales;&lt;BR /&gt;if sales2 then __sales=sales2;&lt;BR /&gt;drop sales sales2;&lt;BR /&gt;rename _sales=sales __sales=sales2;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 21:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395316#M95307</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-12T21:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395320#M95308</link>
      <description>Sorry forget about sales 2. Look at the previous post again. If you notice, observation 2 month 1 is supposed to be 1000, but it is set to missing.</description>
      <pubDate>Tue, 12 Sep 2017 21:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LOCF/m-p/395320#M95308</guid>
      <dc:creator>Wafflecakes</dc:creator>
      <dc:date>2017-09-12T21:52:04Z</dc:date>
    </item>
  </channel>
</rss>

