<?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: Counter Flags in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397134#M95955</link>
    <description>&lt;P&gt;I suspect you would be better off finding an actual date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question: In the following data without knowing the order of the data how do I know (a rule simple enough to tell computers) know which week these to values get?&lt;/P&gt;
&lt;P&gt;1 1 1 Mon 20 1&lt;BR /&gt;1 1 1 Mon 2 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason I ask is if you have an Id visit combination that does not start on Monday or has fewer than 7 actual "days" for a given week a proposed solution may well fail. Can you guarantee that these conditions never occur in your data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what if the Id visit combination exceeds 28 days? What do you want for week? You specifically limit week to 1 - 4?&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2017 14:45:08 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-09-19T14:45:08Z</dc:date>
    <item>
      <title>Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397080#M95933</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to have week number 1-4 in a dataset having days.&lt;/P&gt;&lt;P&gt;I appreciate help since I am getting pretty tired of it.&lt;/P&gt;&lt;P&gt;Thank you anyone!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input id visit daynumber dayname $3. x;&lt;BR /&gt;cards;&lt;BR /&gt;1 1 1 Mon 20&lt;BR /&gt;1 1 2 Tue 30&lt;BR /&gt;1 1 3 Wed 0&lt;BR /&gt;1 1 4 Thu 2&lt;BR /&gt;1 1 5 Fri 4&lt;BR /&gt;1 1 6 Sat 60&lt;BR /&gt;1 1 7 Sun 20&lt;BR /&gt;1 1 1 Mon 2&lt;BR /&gt;1 1 2 Tue 3&lt;BR /&gt;1 1 3 Wed 20&lt;BR /&gt;1 1 4 Thu 20&lt;BR /&gt;1 1 5 Fri 40&lt;BR /&gt;1 1 6 Sat 6&lt;BR /&gt;1 1 7 Sun 2&lt;BR /&gt;1 1 1 Mon 50&lt;BR /&gt;1 1 2 Tue 6&lt;BR /&gt;1 1 3 Wed 9&lt;BR /&gt;1 1 4 Thu 9&lt;BR /&gt;1 1 5 Fri 8&lt;BR /&gt;1 1 6 Sat 8&lt;BR /&gt;1 1 7 Sun 2&lt;BR /&gt;1 1 1 Mon 7&lt;BR /&gt;1 1 2 Tue 3&lt;BR /&gt;1 1 3 Wed 90&lt;BR /&gt;1 1 4 Thu 6&lt;BR /&gt;1 1 5 Fri 9&lt;BR /&gt;1 1 6 Sat 6&lt;BR /&gt;1 1 7 Sun 4&lt;BR /&gt;1 2 1 Mon 30&lt;BR /&gt;1 2 2 Tue 30&lt;BR /&gt;1 2 3 Wed 0&lt;BR /&gt;1 2 4 Thu 2&lt;BR /&gt;1 2 5 Fri 40&lt;BR /&gt;1 2 6 Sat 10&lt;BR /&gt;1 2 7 Sun 10&lt;BR /&gt;1 2 1 Mon 60&lt;BR /&gt;1 2 2 Tue 3&lt;BR /&gt;1 2 3 Wed 1&lt;BR /&gt;1 2 4 Thu 5&lt;BR /&gt;1 2 5 Fri 50&lt;BR /&gt;1 2 6 Sat 1&lt;BR /&gt;1 2 7 Sun 1&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want;&lt;BR /&gt;input id visit daynumber dayname $3. x weeknumber;&lt;BR /&gt;cards;&lt;BR /&gt;1 1 1 Mon 20 1&lt;BR /&gt;1 1 2 Tue 30 1&l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MT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397080#M95933</guid>
      <dc:creator>Manuz</dc:creator>
      <dc:date>2017-09-19T11:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397134#M95955</link>
      <description>&lt;P&gt;I suspect you would be better off finding an actual date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question: In the following data without knowing the order of the data how do I know (a rule simple enough to tell computers) know which week these to values get?&lt;/P&gt;
&lt;P&gt;1 1 1 Mon 20 1&lt;BR /&gt;1 1 1 Mon 2 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason I ask is if you have an Id visit combination that does not start on Monday or has fewer than 7 actual "days" for a given week a proposed solution may well fail. Can you guarantee that these conditions never occur in your data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what if the Id visit combination exceeds 28 days? What do you want for week? You specifically limit week to 1 - 4?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 14:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397134#M95955</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-19T14:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397135#M95956</link>
      <description>&lt;P&gt;So let me put it straight, you are tired of it, therefore you need someone else to do your job?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 14:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397135#M95956</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2017-09-19T14:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397138#M95957</link>
      <description>&lt;P&gt;The problem you've got is that there's nothing in your data which tells us which week an observation belongs to other than it's physical order. It can be done with a counter ( counting upto 7 and then resetting the week number)!but if it's a real example and not an exercise then it's a rather fragile method and not one I'd want to put my name to.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 14:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397138#M95957</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-09-19T14:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397172#M95963</link>
      <description>Thank you for the answer.&lt;BR /&gt;&lt;BR /&gt;I have a date only for the Mondays. It is from a questionnaire used for&lt;BR /&gt;alcohol consumption (TLFB) where they are writing consumption per day,&lt;BR /&gt;each day of the week and only date for Mondays.&lt;BR /&gt;&lt;BR /&gt;this simple code is working&lt;BR /&gt;&lt;BR /&gt;*data* week4;&lt;BR /&gt;&lt;BR /&gt;set have;&lt;BR /&gt;&lt;BR /&gt;by id visit;&lt;BR /&gt;&lt;BR /&gt;if first.visit then week=*0*;&lt;BR /&gt;&lt;BR /&gt;if daynumber= *1* then week+*1*;&lt;BR /&gt;&lt;BR /&gt;*run*;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Sep 2017 15:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397172#M95963</guid>
      <dc:creator>Manuz</dc:creator>
      <dc:date>2017-09-19T15:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397173#M95964</link>
      <description>&lt;P&gt;Hi Haikuo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was too tired to think any longer, you are right &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 15:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397173#M95964</guid>
      <dc:creator>Manuz</dc:creator>
      <dc:date>2017-09-19T15:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397174#M95965</link>
      <description>Thank you anyway Chris. I do have the date for Mondays. I got a solution though.</description>
      <pubDate>Tue, 19 Sep 2017 15:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397174#M95965</guid>
      <dc:creator>Manuz</dc:creator>
      <dc:date>2017-09-19T15:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Counter Flags</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397180#M95966</link>
      <description>I have derived the date from the mondays in my real data, so i do have a date.&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Sep 2017 15:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counter-Flags/m-p/397180#M95966</guid>
      <dc:creator>Manuz</dc:creator>
      <dc:date>2017-09-19T15:50:59Z</dc:date>
    </item>
  </channel>
</rss>

