<?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: How to Get the Year to match Week Function with 'v' descriptor in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616233#M180386</link>
    <description>Use "INTNX" with "&lt;A href="https://documentation.sas.com/?docsetId=leforinforref&amp;amp;docsetTarget=p0g056g35ez8son1sfavozh0lfb3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n1d3z2e1f8u8drn1j70702vf4q3h" target="_self"&gt;Alignment&lt;/A&gt;" to get the year of the last "day of the week".&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options pageno=1 nodate ls=80 ps=64;

title 'Values of the U, V, and W Descriptors';

data a(drop=i date0 date1 y);
date0 = '20dec2019'd;
do y = 0;
 date1 = intnx("YEAR",date0,y,'s');
do i = 0 to 20;
 date = intnx("DAY",date1,i);
year = YEAR(date);
week = week(date);
year_v = YEAR(intnx("WEEK.2",date,0,"e"));
week_v = week(date, 'v'); 
output;
end;
end;
format date WEEKDATX17.;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2020 15:27:20 GMT</pubDate>
    <dc:creator>dcmacedo</dc:creator>
    <dc:date>2020-01-09T15:27:20Z</dc:date>
    <item>
      <title>How to Get the Year to match Week Function with 'v' descriptor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616213#M180373</link>
      <description>&lt;P&gt;I am trying to get the Year to go with the value returned for WEEK Function using the 'v' descriptor.&amp;nbsp; I am compiling data by a 7 day week period and assigning the aggregated data a date of the value returned from the&amp;nbsp;YEAR function and WEEK Function with the 'v' descriptor.&amp;nbsp; ( YYYY WW&amp;nbsp;) I have run into an issue with the New Year.&amp;nbsp; I get the correct WEEK for December 30 and 31 (1st week of Year 2020).&amp;nbsp; However, I can't figure out how to return the Year 2020 to match the week.&amp;nbsp; I end up getting 2019 01 as the YYYY WW which is not what I want.&amp;nbsp; I want it to return as 2020 01.&amp;nbsp; Any thoughts would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options pageno=1 nodate ls=80 ps=64;

title 'Values of the U, V, and W Descriptors';

data a(drop=i date0 date1 y);
date0 = '20dec2019'd;
do y = 1;
 date1 = intnx("YEAR",date0,y,'s');
do i = 0 to 20;
 date = intnx("DAY",date1,i);
year = YEAR(date);
week = week(date);
 week_u = week(date, 'u'); 
 week_v = week(date, 'v'); 
 week_w = week(date, 'w'); 
output;
end;
end;
format date WEEKDATX17.;
run;&lt;BR /&gt;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&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;</description>
      <pubDate>Thu, 09 Jan 2020 14:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616213#M180373</guid>
      <dc:creator>KevinPorter</dc:creator>
      <dc:date>2020-01-09T14:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get the Year to match Week Function with 'v' descriptor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616233#M180386</link>
      <description>Use "INTNX" with "&lt;A href="https://documentation.sas.com/?docsetId=leforinforref&amp;amp;docsetTarget=p0g056g35ez8son1sfavozh0lfb3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n1d3z2e1f8u8drn1j70702vf4q3h" target="_self"&gt;Alignment&lt;/A&gt;" to get the year of the last "day of the week".&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options pageno=1 nodate ls=80 ps=64;

title 'Values of the U, V, and W Descriptors';

data a(drop=i date0 date1 y);
date0 = '20dec2019'd;
do y = 0;
 date1 = intnx("YEAR",date0,y,'s');
do i = 0 to 20;
 date = intnx("DAY",date1,i);
year = YEAR(date);
week = week(date);
year_v = YEAR(intnx("WEEK.2",date,0,"e"));
week_v = week(date, 'v'); 
output;
end;
end;
format date WEEKDATX17.;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 15:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616233#M180386</guid>
      <dc:creator>dcmacedo</dc:creator>
      <dc:date>2020-01-09T15:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get the Year to match Week Function with 'v' descriptor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616270#M180395</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 17:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616270#M180395</guid>
      <dc:creator>KevinPorter</dc:creator>
      <dc:date>2020-01-09T17:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get the Year to match Week Function with 'v' descriptor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616272#M180396</link>
      <description>&lt;P&gt;Does it meet your need? Accept as a solution.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 17:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Get-the-Year-to-match-Week-Function-with-v-descriptor/m-p/616272#M180396</guid>
      <dc:creator>dcmacedo</dc:creator>
      <dc:date>2020-01-09T17:37:02Z</dc:date>
    </item>
  </channel>
</rss>

