<?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 evaluate various date base on the begining of the week on a Sarturday in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955734#M45692</link>
    <description>I have provided the SAS dataset.  I would like to estimate all the variables that start by PRV such as PRV_Annee, PRV_Quater, and so on, but I don't understand the logic behind</description>
    <pubDate>Fri, 10 Jan 2025 13:18:31 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2025-01-10T13:18:31Z</dc:date>
    <item>
      <title>how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955667#M45686</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have any idea how to estimate the various PRV_varname based on the value of date. Negative Lag ?&lt;/P&gt;
&lt;P&gt;I have notice that the week start on the Saturday and end on a Friday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, if the fist January 2025 is Weneday then the begining of the year will be Saturday 28, 2024&lt;/P&gt;
&lt;P&gt;Any Way, up to now I was unable to find the logic into these variable&lt;/P&gt;
&lt;P&gt;Please don't ask me the purpose of those funzy variables, I don't know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I new to reproduce an existing table but until 2035 without the original SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 20:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955667#M45686</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-01-09T20:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955672#M45687</link>
      <description>&lt;P&gt;Most of us refuse (or cannot) download Excel files, they can be security threats. You need to provide data as SAS data step code, as you have done properly in other threads.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I personally assert my rights to ask questions if I feel it is necessary.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 21:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955672#M45687</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-09T21:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955677#M45688</link>
      <description>&lt;P&gt;I cannot figure out what your question is.&lt;/P&gt;
&lt;P&gt;What does "&lt;SPAN&gt;various PRV_varname" mean?&amp;nbsp; The attached spreadsheet is not very helpful.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You mentioned that weeks start on Saturday instead of Sunday.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Does that mean you want to calculate week number?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 22:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955677#M45688</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-09T22:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955682#M45689</link>
      <description>&lt;P&gt;Instead of an xlsx file attached a text file with a SAS data step that creates the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to provide a bit more detailed explanation for the logic required to calculate these derived date variables. I suggest you focus on only one of these variables and we go from there.&lt;/P&gt;
&lt;P&gt;I'd also recommend that you cut-down the sample data to the minimum required to explain the logic and test solutions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below code provides some example code for use of intnx() with start of year being first Saturday of the year. More info provided already as answer to &lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/working-with-intnx-function/m-p/955568#M45675" target="_self"&gt;your earlier question&lt;/A&gt;.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Therefore, if the fist January 2025 is Weneday then the begining of the year will be Saturday 28, 2024 */
data demo;
	format date weekdatx. sat_start_of_week sat_start_of_year date9.;
	do date='20dec2024'd to '10jan2025'd;
		sat_start_of_week=intnx('week.7',date,0,'b');
		sat_start_of_year=intnx('year', sat_start_of_week, 0, 'b');
		output;
	end;
run;

proc print data=demo;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1736473611941.png" style="width: 466px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103633i9FAAE990F5D75442/image-dimensions/466x528?v=v2" width="466" height="528" role="button" title="Patrick_0-1736473611941.png" alt="Patrick_0-1736473611941.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 02:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955682#M45689</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-01-10T02:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955683#M45690</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
input date date9.;
want=intnx('week.7',date,0);
put date= date9. want= date9.;
cards;
01jan2025
28jan2025
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;17   data _null_;
18   input date date9.;
19   want=intnx('week.7',date,0);
20   put date= date9. want= date9.;
21   cards;

&lt;STRONG&gt;date=01JAN2025 want=28DEC2024
date=28JAN2025 want=25JAN2025&lt;/STRONG&gt;
NOTE: “DATA 语句”所用时间（总处理时间）:
      实际时间          0.01 秒
      CPU 时间          0.00 秒
&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Jan 2025 01:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955683#M45690</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-10T01:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955733#M45691</link>
      <description>&lt;P&gt;Here's the sas dataset&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 13:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955733#M45691</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-01-10T13:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955734#M45692</link>
      <description>I have provided the SAS dataset.  I would like to estimate all the variables that start by PRV such as PRV_Annee, PRV_Quater, and so on, but I don't understand the logic behind</description>
      <pubDate>Fri, 10 Jan 2025 13:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955734#M45692</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-01-10T13:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to evaluate various date base on the begining of the week on a Sarturday</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955746#M45693</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First thank you very much for you SAS code to get the week start date on a Saturday.&lt;/P&gt;
&lt;P&gt;I have kept the same logic for the end of the week.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for the begining of the year, and the end of the year I think values could be different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Therefore, if the fist January 2025 is Weneday then the begining of the year will be Saturday 28, 2024 */
data demo;
	format date weekdatx.  sat_start_of_week sat_end_of_week sat_start_of_year sat_end_of_year date9.;
	do date='28dec2013'd to '10jan2015'd;
		sat_start_of_week=intnx('week.7',date,0,'b');
		sat_end_of_week=intnx('week.7',date,0,'e');
		sat_start_of_year=intnx('year', sat_start_of_week, 0, 'b');
		sat_end_of_year=intnx('year', sat_start_of_week, 0, 'e');
		output;
	end;
run;

proc print data=demo;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am pretty confortable with the estimate for the begining and the end of the week.&amp;nbsp; It starts on Saturday and end on a Friday.&lt;/P&gt;
&lt;P&gt;But if for the week we have a lead of few day should we expect the same for the year ?&amp;nbsp; So should the year 2014 start on 28dec2013 and end on 02jan2015 ?&lt;BR /&gt;So if I want to apply that logic, how do we estimate those two dates?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 16:13:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-evaluate-various-date-base-on-the-begining-of-the-week-on/m-p/955746#M45693</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-01-10T16:13:35Z</dc:date>
    </item>
  </channel>
</rss>

