<?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: Converting dates fromYYWW to sas date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-fromYYWW-to-sas-date/m-p/312687#M67851</link>
    <description>&lt;P&gt;The WEEKx informat requires to have a "W" between the year and the week.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could use the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  week = "1034";
  weekDate = input( cats(substr(week, 1, 2), "w", substr(week, 3, 2)), weekv8.);


  format weekDate weekDate.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There are various informats, but since you need it to be a Monday use the WEEKV. infromat.&lt;/P&gt;
&lt;P&gt;Since you have 2 digist for the year, pay attention to the YEARCUTOFF system option, as this will determine whether it will be 2010 or 1910.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2016 17:34:13 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2016-11-18T17:34:13Z</dc:date>
    <item>
      <title>Converting dates fromYYWW to sas date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-fromYYWW-to-sas-date/m-p/312584#M67823</link>
      <description>&lt;P&gt;Hi SAS programmers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to do a follow up study on a data set where the dates are only available as year and week stored in the same variable as YYWW (ie 1034 corresponds to 2010 week 34). I would like to covert this variable to a sas date, prefferably to the corresponding monday, however I have had no luck doing so.&lt;/P&gt;&lt;P&gt;I am not very experienced with sas, so the answer might be quite trivial, but I was unable to find the answer using my usual ressources (the little sas book and google).&lt;/P&gt;&lt;P&gt;Hopefully you can help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Alexander&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2016 11:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-dates-fromYYWW-to-sas-date/m-p/312584#M67823</guid>
      <dc:creator>AAP</dc:creator>
      <dc:date>2016-11-18T11:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Converting dates fromYYWW to sas date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-fromYYWW-to-sas-date/m-p/312590#M67824</link>
      <description>&lt;P&gt;You can use the weeku format, although you will likely need to add the "W" in to get it to work.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002604468.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002604468.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you could use intnx() function, i.e. substr(1,2)=year, then from 01JAN that year intnx("week",substr(3,2)). &amp;nbsp;To move the date number of weeks forward.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  yywk="1013";
  date1=input(catx("W",substr(yywk,1,2),substr(yywk,3,2)),weeku5.);
  format date1 date9.;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Nov 2016 11:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-dates-fromYYWW-to-sas-date/m-p/312590#M67824</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-18T11:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Converting dates fromYYWW to sas date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-dates-fromYYWW-to-sas-date/m-p/312687#M67851</link>
      <description>&lt;P&gt;The WEEKx informat requires to have a "W" between the year and the week.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could use the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  week = "1034";
  weekDate = input( cats(substr(week, 1, 2), "w", substr(week, 3, 2)), weekv8.);


  format weekDate weekDate.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There are various informats, but since you need it to be a Monday use the WEEKV. infromat.&lt;/P&gt;
&lt;P&gt;Since you have 2 digist for the year, pay attention to the YEARCUTOFF system option, as this will determine whether it will be 2010 or 1910.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2016 17:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-dates-fromYYWW-to-sas-date/m-p/312687#M67851</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-11-18T17:34:13Z</dc:date>
    </item>
  </channel>
</rss>

