<?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: creating time-dependent variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498060#M132241</link>
    <description>&lt;P&gt;This is an excellent homework assignment for understanding BY variables, and retaining values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What have you tried so far?&lt;/P&gt;</description>
    <pubDate>Sat, 22 Sep 2018 11:45:49 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2018-09-22T11:45:49Z</dc:date>
    <item>
      <title>creating time-dependent variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498049#M132234</link>
      <description>&lt;P&gt;hello, i'm trying to create time-dependent variable, which means that the square of 'visiting number of each clinics' changes over time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1) square of 'visiting number of each clinics means&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1234.jpg" style="width: 125px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23459i8A25AF9A1A4A520A/image-size/large?v=v2&amp;amp;px=999" role="button" title="1234.jpg" alt="1234.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ni is visiting number of 'i' clinic.&lt;BR /&gt;M is number of clinic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and if i go to clinic 'a' and clinic 'b' in following sequence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a a a b b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... then total square is 9+4 = 13.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) and i want make this 'total square' in time-dependent variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is raw data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id clinic&lt;/P&gt;&lt;P&gt;1 a&lt;BR /&gt;1 a&lt;BR /&gt;1 b&lt;BR /&gt;1 b&lt;BR /&gt;1 a&lt;BR /&gt;1 c&lt;BR /&gt;2 a&lt;BR /&gt;2 b&lt;BR /&gt;2 c&lt;BR /&gt;3 a&lt;BR /&gt;3 a&lt;BR /&gt;3 a&lt;BR /&gt;3 b&lt;BR /&gt;3 a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...and i want to create dataset like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id clinic totalsquare&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 a 1&lt;BR /&gt;1 a 4&lt;BR /&gt;1 b 5 *4+1*&lt;BR /&gt;1 b 8 *4+4*&lt;BR /&gt;1 a 13 *4+9*&lt;BR /&gt;1 c 14 *1+4+9*&lt;BR /&gt;2 a 1&lt;BR /&gt;2 b 2 *1+1*&lt;BR /&gt;2 c 3 *1+1+1*&lt;BR /&gt;3 a 1&lt;BR /&gt;3 a 4&lt;BR /&gt;3 a 9&lt;BR /&gt;3 b 10 *1+9*&lt;BR /&gt;3 a 17 *1+16*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your help.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 06:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498049#M132234</guid>
      <dc:creator>km0927</dc:creator>
      <dc:date>2018-09-22T06:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: creating time-dependent variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498060#M132241</link>
      <description>&lt;P&gt;This is an excellent homework assignment for understanding BY variables, and retaining values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What have you tried so far?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 11:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498060#M132241</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-09-22T11:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: creating time-dependent variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498061#M132242</link>
      <description>&lt;P&gt;1. in retain variable, i don't know how to replace retained value to another.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 a 1&lt;/P&gt;&lt;P&gt;1 b 1+1&lt;/P&gt;&lt;P&gt;1 c 1+1+1&lt;/P&gt;&lt;P&gt;1 c 1+1+&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i use retain variable by group, the last row become '1+1+&lt;STRONG&gt;1+4&lt;/STRONG&gt;'(third '1' is retained from third row)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. and when i use 'retain' by id and clinic, then i have to use 'proc sort' by id and clinic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to make cumulative square sum in time order.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 11:58:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498061#M132242</guid>
      <dc:creator>km0927</dc:creator>
      <dc:date>2018-09-22T11:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: creating time-dependent variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498117#M132276</link>
      <description>&lt;P&gt;I'm not sure why you marked my comment as a solution for this topic.&amp;nbsp; However, if you show even your code for reading in the original variables, without attempting the cumulative sum-of-squares, then you can have a start at getting help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable to be "retained" is the cumulative sum of squares, which you (1) want to update with every incoming observation, and (2) you want to reset every time you begin a new id.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 21:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-time-dependent-variables/m-p/498117#M132276</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-09-22T21:24:58Z</dc:date>
    </item>
  </channel>
</rss>

