<?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: Extract Week from first.date in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Extract-Week-from-first-date/m-p/262252#M7201</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id date mmddyy10. ;
cards;                     
1 01/01/2016
1 01/14/2016
1 01/22/2016
2 02/16/2016
2 04/03/2016
;
run;
 proc sort  data=have;
 by id date;
 run;
 
 
 data want ;
 set have;
 by id;
 retain week;
 if first.id then  week=intck('week',intnx('month',date,0),date)+1; 
 run;
   &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Apr 2016 00:52:44 GMT</pubDate>
    <dc:creator>mohamed_zaki</dc:creator>
    <dc:date>2016-04-08T00:52:44Z</dc:date>
    <item>
      <title>Extract Week from first.date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extract-Week-from-first-date/m-p/262247#M7200</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&amp;nbsp;have;&lt;/P&gt;&lt;P&gt;input id date&amp;nbsp;;&lt;/P&gt;&lt;P&gt;datalines;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id &amp;nbsp; date&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;01/01/2016&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;01/14/2016&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;01/22/2016&lt;/P&gt;&lt;P&gt;2 02/03/2016&lt;/P&gt;&lt;P&gt;2 04/03/2016&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract week from the first date for the id (observation) and add the same value to others even if the others are different eg&lt;/P&gt;&lt;P&gt;Data want&lt;/P&gt;&lt;P&gt;id &amp;nbsp;data &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;week&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;01/01/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;01/14/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;01/22/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2 02/08/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;2 04/25/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 00:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extract-Week-from-first-date/m-p/262247#M7200</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2016-04-08T00:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Week from first.date</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extract-Week-from-first-date/m-p/262252#M7201</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id date mmddyy10. ;
cards;                     
1 01/01/2016
1 01/14/2016
1 01/22/2016
2 02/16/2016
2 04/03/2016
;
run;
 proc sort  data=have;
 by id date;
 run;
 
 
 data want ;
 set have;
 by id;
 retain week;
 if first.id then  week=intck('week',intnx('month',date,0),date)+1; 
 run;
   &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Apr 2016 00:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extract-Week-from-first-date/m-p/262252#M7201</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-04-08T00:52:44Z</dc:date>
    </item>
  </channel>
</rss>

