<?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: Create multiple records from single record by timevariable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236045#M43199</link>
    <description>&lt;P&gt;I think a slight variation on ballardw's program would do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; original_week_end = week_end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do week_start = week_start to original_week_end by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_end = min(original_week_end, week_start + 3);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; drop original_week_end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Nov 2015 18:21:43 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-11-23T18:21:43Z</dc:date>
    <item>
      <title>Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236036#M43191</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi there&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a relatively simple problem, or at least i think so, but after two hours of search, i must admit that i still can't solve it.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What I have is a dataset looking like:&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;id &amp;nbsp;week_start &amp;nbsp; week_end &amp;nbsp; year &amp;nbsp; &amp;nbsp; &amp;nbsp; x1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;52 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 79 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1999 &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;78 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1999 &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And so on for the all my id. So I have that each observation have som characterisk for some interval of time (week_end-week_start).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What I want is to "split each observation by into monthly interval:&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;id &amp;nbsp;week_start &amp;nbsp; week_end &amp;nbsp; year &amp;nbsp; &amp;nbsp; &amp;nbsp; x1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 17 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 21 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;24 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;28 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;32 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;36 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 37 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;41 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 42 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;46 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 47 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;52 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;56 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1999 &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And so on...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not have a clue, what i am going to do. It could be really nice, if someone could help me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 17:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236036#M43191</guid>
      <dc:creator>CFF</dc:creator>
      <dc:date>2015-11-23T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236037#M43192</link>
      <description>&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do week_start = 1 to 47 by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_end = week_start + 3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should do it.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 17:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236037#M43192</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-11-23T17:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236045#M43199</link>
      <description>&lt;P&gt;I think a slight variation on ballardw's program would do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; original_week_end = week_end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do week_start = week_start to original_week_end by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_end = min(original_week_end, week_start + 3);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; drop original_week_end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 18:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236045#M43199</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-23T18:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236057#M43208</link>
      <description>&lt;P&gt;This almost solve my problem.&amp;nbsp;&lt;BR /&gt;But what do i do with the years after that?&amp;nbsp;&lt;BR /&gt;I have tried:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if year=1998 then do:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;week_start = 1 to 47 by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_end = week_start + 3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;if year=1999 then do&lt;/P&gt;
&lt;P&gt;week_start = 53 to 99 by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_end = week_start + 3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;But it does not seem work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 18:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236057#M43208</guid>
      <dc:creator>CFF</dc:creator>
      <dc:date>2015-11-23T18:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236061#M43210</link>
      <description>This almost solve my problem. &lt;BR /&gt;But what do i do with the years after that? &lt;BR /&gt;I have tried: &lt;BR /&gt;if year=1998 then do: &lt;BR /&gt;week_start = 1 to 47 by 4;&lt;BR /&gt;        week_end = week_start + 3;&lt;BR /&gt;       output;&lt;BR /&gt;   end;&lt;BR /&gt;if year=1999 then do&lt;BR /&gt;week_start = 53 to 99 by 4;&lt;BR /&gt;        week_end = week_start + 3;&lt;BR /&gt;       output;&lt;BR /&gt;   end;&lt;BR /&gt;run;&lt;BR /&gt;But it does not seem work. &lt;BR /&gt;</description>
      <pubDate>Mon, 23 Nov 2015 18:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236061#M43210</guid>
      <dc:creator>CFF</dc:creator>
      <dc:date>2015-11-23T18:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236063#M43212</link>
      <description>&lt;P&gt;I'm not sure that you're actually looking at my program.&amp;nbsp; I haven't hard-coded any part of the loop such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 to 47&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, I start the loop at the value of WEEK_START.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only issue that I didn't try to address was when to keep 5 weeks in a goup instead of 4.&amp;nbsp; The rules really aren't specified, so I left it as all 4-week groups, and the leftover week(s) go into their own observation even if it's only 1 week that is left over.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try it and see how close it comes to what you need.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 19:03:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236063#M43212</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-23T19:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236068#M43215</link>
      <description>&lt;P&gt;There are only 52 weeks in a year.&amp;nbsp;What does a week &amp;gt; 52 (or possibly 53) even mean? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 19:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236068#M43215</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-23T19:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236080#M43218</link>
      <description>&lt;P&gt;Hi again Astounding&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sorry i got the copy-paste wrong. So my reply to you was a little different.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am close to the goal with your code&lt;/P&gt;
&lt;P&gt;What i need (and what i have not specified!) is each observation to "dividided" into 12 month - some consistent of 4 others of 5.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have not adressed which to consist of 5 because i did not believe that it could be coded?&amp;nbsp;&lt;BR /&gt;But okay: Each year i know which month to consist of 5 weeks.&amp;nbsp;&lt;BR /&gt;Lets say that in first year: 1-52 i know that it is month 5 and 7,8 which should contain 5 weeks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and it is different in the next year.&amp;nbsp;&lt;BR /&gt;Is it possible to code that?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not. I just want 12 observations per year, and the last month to contain 4 weeks.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;PS: Thanks for the quick reply!!&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>Mon, 23 Nov 2015 20:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236080#M43218</guid>
      <dc:creator>CFF</dc:creator>
      <dc:date>2015-11-23T20:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236087#M43219</link>
      <description>&lt;P&gt;Anything is possible.&amp;nbsp; But there are a couple of missing ingredients here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(1) How is it possible that your second observation goes from week 53 to week 79?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(2) Is the information about which months have 4 weeks and which have 5 in your head, or is it contained in a data set?&amp;nbsp; (if in a data set, what does the data set look like?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There may be further small pieces to fill in here and there, but those two are the dealbreakers.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 20:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236087#M43219</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-23T20:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236091#M43221</link>
      <description>&lt;P&gt;Fantastic response!&amp;nbsp;&lt;BR /&gt;1)It is because there are two observations on id=1 in the following year (1999), which i may forgot to point out.&amp;nbsp;&lt;BR /&gt;2) It is not explicitly in the dataset, the observations per id is now sat so that they "split" each year, and maybe&amp;nbsp;&lt;BR /&gt;if they change their x1-state (as id=1 do in 1999) in a given year.&amp;nbsp;&lt;BR /&gt;I dont know if that makes sense. If not, just say so and i would like to try a formulate it again.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With that being said it is not completely random which month to have 4 and which to have 5,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it follows the year calender/a specific year calender.&lt;BR /&gt;&lt;BR /&gt;Do you need more information?&amp;nbsp;&lt;BR /&gt;Thank you!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 20:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236091#M43221</guid>
      <dc:creator>CFF</dc:creator>
      <dc:date>2015-11-23T20:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236100#M43229</link>
      <description>&lt;P&gt;I think you may want to back up a bit and actually use DATE values as there are functions to do manipulations and formats for display that work. There are several definitions of WEEK, especially as to how the begining and end of year weeks are treated. Please see for example the online documentation of the formats WEEK, WEEKU, WEEKV and WEEKW, or the WEEK function and the options u, v and w.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Choices may well depend on what you are doing next.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 21:25:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236100#M43229</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-11-23T21:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236183#M43259</link>
      <description>&lt;P&gt;I think the best way to proceed would be for you to create a SAS data set that indicates which time periods contain 5 weeks. &amp;nbsp;After what I hope is enough thought, the structure should be like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(a) Just two variables: &amp;nbsp;year and week&lt;/P&gt;
&lt;P&gt;(b) Just one observation indicating each 5-week time period&lt;/P&gt;
&lt;P&gt;(c) The value for WEEK should be the week that is the 4th week in the 5-week time period&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would also simplify things slightly if you could supply the range of years in the data.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 12:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236183#M43259</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-24T12:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236221#M43268</link>
      <description>&lt;P&gt;But my dataset still look like:&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;id &amp;nbsp;week_start &amp;nbsp; week_end &amp;nbsp; year &amp;nbsp; &amp;nbsp; &amp;nbsp; x1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;52 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;53 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 79 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1999 &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;78 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1999 &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;52 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1998 &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;So how do i create these observations indicating each 5-week time period?&amp;nbsp;&lt;BR /&gt;What if i choose the first 9 period to contain 4 weeks, and the last 3 to contain 5 weeks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;would that be possible??&amp;nbsp;&lt;BR /&gt;Im sorry. Im new to coding. I have tried to search on "do statement sas examples", but none seems to match my problem here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 16:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236221#M43268</guid>
      <dc:creator>CFF</dc:creator>
      <dc:date>2015-11-24T16:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236227#M43270</link>
      <description>&lt;P&gt;You're jumping a step ahead, worrying about how to program using all the data.&amp;nbsp; For now, start with getting the 5-week periods defined.&amp;nbsp; For example (fictitious example):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Year&amp;nbsp;&amp;nbsp; Week&lt;/P&gt;
&lt;P&gt;1999&amp;nbsp;&amp;nbsp;&amp;nbsp; 23&lt;/P&gt;
&lt;P&gt;1999&amp;nbsp;&amp;nbsp;&amp;nbsp; 34&lt;/P&gt;
&lt;P&gt;1999&amp;nbsp;&amp;nbsp;&amp;nbsp; 41&lt;/P&gt;
&lt;P&gt;2000&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&lt;/P&gt;
&lt;P&gt;2000&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first record indicates that in 1999, the first five-week grouping is from week 20 through week 24.&amp;nbsp; (When week=23 in the data, it is the fourth week of a five-week group.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I you can create a data set that defines all the five-week groupings, we'll figure out a way to use it.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 17:12:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236227#M43270</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-24T17:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236232#M43271</link>
      <description>&lt;P&gt;I misunderstood you.&amp;nbsp;&lt;BR /&gt;I have created that now. Should I merge the new dataset with the old?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 17:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236232#M43271</guid>
      <dc:creator>CFF</dc:creator>
      <dc:date>2015-11-24T17:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple records from single record by timevariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236438#M43326</link>
      <description>&lt;P&gt;OK, let's give this a shot. &amp;nbsp;This is untested code, so I hope it requires a minimum of debugging.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;array addaweek {1998:2000, 53};&lt;/P&gt;
&lt;P&gt;if _n_=1 then do until (done);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set _5_week_periods end=done;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;addaweek{year, week}=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;retain addaweek:;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;original_week_end = week_end;&lt;/P&gt;
&lt;P&gt;do week_start = week_start to original_week_end by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;week_end = min(original_week_end, week_start + 3);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;add1 = 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;do week = week_start to week_end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; add1 + addaweek{year, week};&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; if add1=0 then output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; else do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;week_end = min(original_week_end, week_end + 1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;week_start = week_start + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;drop original_week_end add1 addaweek:;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think it works, but like I said it's untested. &amp;nbsp;The idea is that the top DO loop loads the additional data set (the one that indicates the 5-week time periods) into an array. &amp;nbsp;The rest of the DATA step breaks up the time periods into blocks of 4 (or 5) weeks. &amp;nbsp;There are still loose ends such as what should happen when a block of 4 weeks ends in the middle of a 5-week month. &amp;nbsp;But the code at least does make a decision about that. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See how close this comes to what you need. &amp;nbsp;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 16:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-records-from-single-record-by-timevariable/m-p/236438#M43326</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-25T16:06:11Z</dc:date>
    </item>
  </channel>
</rss>

