<?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  num variable from a date format weekv7. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711525#M26942</link>
    <description>&lt;P&gt;You have the WEEK functions AFTER the only output statement. So the values are not set when the data is written.&lt;/P&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;PRE&gt;do date = currdate - 35 to currdate - 1 by 7;
   number = input(substr(string,4,2),32.);
   weeku = week(date,'u');
   weekv = week(date,'v');
   weekw = week(date,'w');
   output;
end;
&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Jan 2021 18:20:24 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-01-14T18:20:24Z</dc:date>
    <item>
      <title>extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711506#M26934</link>
      <description>&lt;P&gt;hello dear SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the following Code to select datalines by week:&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Auswertungstag=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today());&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; zeitraum (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;keep&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=date);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; currdate &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;weekv7.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Auswertungstag = &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Auswertungstag.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;kw&lt;/I&gt;&lt;/STRONG&gt;(&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Auswertungstag.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Jahr = &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Jahr1.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;currdate = input(cats(put(Jahr,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;z4.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'W'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,put(kw_kompakt,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;z2.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)),&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;weekv7.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date = currdate - &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;35&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; currdate - &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&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 face="Courier New" size="3" color="#0000ff"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&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 face="Courier New" size="3"&gt;I get the results like this:&lt;/FONT&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;20W5001&lt;BR /&gt;20W5101&lt;BR /&gt;20W5201&lt;BR /&gt;20W5301&lt;BR /&gt;21W0101&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Need to extract the week number (1st. line: 50 ; 2nd line: 51 etc) and store it as a numeric value.&lt;/P&gt;&lt;P&gt;How can I proceed? I tried with substr(date,4,2) but it doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 17:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711506#M26934</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-01-14T17:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711508#M26936</link>
      <description>&lt;P&gt;What are you starting with?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have the strings like '&lt;SPAN&gt;20W5001' ?&amp;nbsp; If so then just pull out the '50' and use INPUT() to convert it to a number.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you have something else then please provide a much clearer example of what is your input and what is your desired output.&amp;nbsp; Your current code seems to have little relationship to your question.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;string = '20W5001' ;
number = input(substr(string,4,2),32.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 17:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711508#M26936</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-14T17:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711509#M26937</link>
      <description>&lt;P&gt;For any given actual date there are 3 different standard week number definitions that the Week function may use to get a week number. If the Date of interest that you have is using a WEEKV format then likely you need the Week function with the 'V' option to get a numeric value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   format date   weekv7.;
   do date='01jan2021'd to '31dec2021'd;
      weeku = week(date,'u');
      weekv = week(date,'v');
      weekw = week(date,'w');
      output;
   end;
run;&lt;/PRE&gt;
&lt;P&gt;Just to show the three possible "week" values from a given date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 17:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711509#M26937</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-14T17:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711511#M26939</link>
      <description>This doesn't work at all.</description>
      <pubDate>Thu, 14 Jan 2021 17:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711511#M26939</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-01-14T17:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711516#M26941</link>
      <description>&lt;P&gt;I don't get the expected results, so I guess I'm not using the functions properly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; zeitraum (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;keep&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=date number weeku weekv weekw);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; currdate &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;yymmdd10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;weekv7.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Auswertungstag = &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Auswertungstag.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;kw&lt;/I&gt;&lt;/STRONG&gt;(&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Auswertungstag.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Jahr = &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;Jahr1.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;currdate = input(cats(put(Jahr,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;z4.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'W'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,put(kw_kompakt,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;z2.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)),&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;weekv7.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date = currdate - &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;35&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; currdate - &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&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 face="Courier New" size="3" color="#0000ff"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;number = input(substr(string,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;32.&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 face="Courier New" size="3"&gt;weeku = week(date,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'u'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;weekv = week(date,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'v'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;weekw = week(date,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'w'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&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 face="Courier New" size="3"&gt;which gives the following result: &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas_14012021.PNG" style="width: 472px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53509i32736B6D89B0FEE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas_14012021.PNG" alt="sas_14012021.PNG" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;In Addition, the kw macro is the following:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; kw(datum);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* datum1 ist immer ein Donnerstag, da nach DIN 1355 die erste KW die Woche ist, in&lt;/P&gt;&lt;P&gt;der mindestens 4 Tage des neuen Jahres sind, s. Link oben zu Wiki */&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;datum1=&amp;amp;datum-mod(&amp;amp;datum-mdy(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1900&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;3&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 face="Courier New" size="3"&gt;korrektur1=mod(&amp;amp;datum-mdy(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1900&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;10&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 face="Courier New" size="3"&gt;datum2=mdy(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,year(datum1))+korrektur1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tage=&amp;amp;datum-datum2;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;kwcalc=int(tage/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&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 face="Courier New" size="3"&gt;kw_kompakt=int((&amp;amp;datum-(mdy(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,year(&amp;amp;datum-mod(&amp;amp;datum-mdy(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1900&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;))+(mod(&amp;amp;datum-mdy(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1900&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)))/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;7&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 face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; kw;&lt;/FONT&gt;&lt;/P&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 17:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711516#M26941</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-01-14T17:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711525#M26942</link>
      <description>&lt;P&gt;You have the WEEK functions AFTER the only output statement. So the values are not set when the data is written.&lt;/P&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;PRE&gt;do date = currdate - 35 to currdate - 1 by 7;
   number = input(substr(string,4,2),32.);
   weeku = week(date,'u');
   weekv = week(date,'v');
   weekw = week(date,'w');
   output;
end;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jan 2021 18:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711525#M26942</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-14T18:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711625#M26953</link>
      <description>weekv is the good choice.</description>
      <pubDate>Fri, 15 Jan 2021 09:33:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711625#M26953</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-01-15T09:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711660#M26957</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there an analog way to extract the year?&lt;/P&gt;&lt;P&gt;20W5001 =&amp;gt; 2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 12:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711660#M26957</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-01-15T12:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711833#M26969</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;is there an analog way to extract the year?&lt;BR /&gt;20W5001 =&amp;gt; 2020&lt;BR /&gt;</description>
      <pubDate>Sat, 16 Jan 2021 06:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711833#M26969</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-01-16T06:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: extract  num variable from a date format weekv7.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711937#M26974</link>
      <description>&lt;P&gt;For such a question, consult the documentation of&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;SAS Functions and CALL Routines by Category&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;Scroll down to the Date and Time section, and you will quickly find the&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p13eycdrmfb0l8n1492z3wocpt3s.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;YEAR Function&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jan 2021 10:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/extract-num-variable-from-a-date-format-weekv7/m-p/711937#M26974</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-17T10:44:28Z</dc:date>
    </item>
  </channel>
</rss>

