<?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: Creating new data periods from yearly snapshot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358982#M84396</link>
    <description>&lt;P&gt;&lt;STRONG&gt;proc sort data=in;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;by id ;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data out;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;set in;&lt;/P&gt;&lt;P&gt;by id height notsorted;&lt;/P&gt;&lt;P&gt;if last.height;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naveen Srinivasan&lt;/P&gt;&lt;P&gt;&amp;nbsp;Edited: I &lt;STRONG&gt;missed to read your question&lt;/STRONG&gt; properly. Well, in any case when Xia keshan answers, one can blindly copy the genius. My apologies!&lt;/P&gt;</description>
    <pubDate>Tue, 16 May 2017 12:36:56 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2017-05-16T12:36:56Z</dc:date>
    <item>
      <title>Creating new data periods from yearly snapshot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358976#M84393</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am struggling to create new FROM and VALID to dates from yearly snapshots. I need to create the dates based on change in HEIGHT. I have posted a IN and OUT data. Please see if you could help. Need to create the out data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; in;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; id &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; valid_from &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; valid_to &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; height &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; id valid_from valid_to height;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; valid_from &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; valid_to &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;1 01/01/2010 01/01/2011 3&lt;/P&gt;
&lt;P&gt;1 01/01/2011 01/01/2012 4&lt;/P&gt;
&lt;P&gt;1 01/01/2012 01/01/2013 4&lt;/P&gt;
&lt;P&gt;1 01/01/2013 01/01/2014 4&lt;/P&gt;
&lt;P&gt;1 01/01/2014 01/01/2015 13&lt;/P&gt;
&lt;P&gt;1 01/01/2015 01/01/2016 3&lt;/P&gt;
&lt;P&gt;2 01/01/2011 01/01/2012 20&lt;/P&gt;
&lt;P&gt;2 01/01/2012 01/01/2013 20&lt;/P&gt;
&lt;P&gt;2 01/01/2013 01/01/2014 21&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; out;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; id &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; valid_from &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; valid_to &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; height &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; id valid_from valid_to height;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; valid_from &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; valid_to &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;1 01/01/2010 01/01/2011 3&lt;/P&gt;
&lt;P&gt;1 01/01/2011 01/01/2014 4&lt;/P&gt;
&lt;P&gt;1 01/01/2014 01/01/2015 13&lt;/P&gt;
&lt;P&gt;1 01/01/2015 01/01/2016 3&lt;/P&gt;
&lt;P&gt;2 01/01/2011 01/01/2013 20&lt;/P&gt;
&lt;P&gt;2 01/01/2013 01/01/2014 21&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 11:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358976#M84393</guid>
      <dc:creator>Jane7476</dc:creator>
      <dc:date>2017-05-16T11:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new data periods from yearly snapshot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358982#M84396</link>
      <description>&lt;P&gt;&lt;STRONG&gt;proc sort data=in;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;by id ;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data out;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;set in;&lt;/P&gt;&lt;P&gt;by id height notsorted;&lt;/P&gt;&lt;P&gt;if last.height;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naveen Srinivasan&lt;/P&gt;&lt;P&gt;&amp;nbsp;Edited: I &lt;STRONG&gt;missed to read your question&lt;/STRONG&gt; properly. Well, in any case when Xia keshan answers, one can blindly copy the genius. My apologies!&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 12:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358982#M84396</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-05-16T12:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new data periods from yearly snapshot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358992#M84403</link>
      <description>&lt;PRE&gt;

data in;
informat id 1. valid_from MMDDYY10. valid_to MMDDYY10. height 8.;
input id valid_from valid_to height;
format valid_from date9. valid_to date9.;
cards;
1 01/01/2010 01/01/2011 3
1 01/01/2011 01/01/2012 4
1 01/01/2012 01/01/2013 4
1 01/01/2013 01/01/2014 4
1 01/01/2014 01/01/2015 13
1 01/01/2015 01/01/2016 3
2 01/01/2011 01/01/2012 20
2 01/01/2012 01/01/2013 20
2 01/01/2013 01/01/2014 21
;
run;
 
data want;
 set in;
 by id height notsorted;
 retain temp;
 if first.height then temp=valid_from;
 if last.height then do;valid_from=temp;output;end;
 drop temp;
run;


&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 May 2017 12:30:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358992#M84403</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-05-16T12:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new data periods from yearly snapshot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358993#M84404</link>
      <description>&lt;P&gt;Thanks for replying. Yes it didn't take into account changing the from data in row 2 to 2011 - except that it works fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had totally forgotton about the notsorted option...that was the missing like for me. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 12:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-data-periods-from-yearly-snapshot/m-p/358993#M84404</guid>
      <dc:creator>Jane7476</dc:creator>
      <dc:date>2017-05-16T12:46:12Z</dc:date>
    </item>
  </channel>
</rss>

