<?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 change the value of a variable in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/How-to-change-the-value-of-a-variable/m-p/378982#M3112</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;Exactly what I meant. Thank you!!!&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2017 13:23:37 GMT</pubDate>
    <dc:creator>noemi_b</dc:creator>
    <dc:date>2017-07-25T13:23:37Z</dc:date>
    <item>
      <title>How to change the value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-change-the-value-of-a-variable/m-p/378971#M3109</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am working on SAS University Edition v.9.4. and I need your help to change the value of a variable across time. I know it is an easy task, but I am a SAS beginner user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will first provide you with a small datastep of my dataset. So that you can play a bit around with it!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; customer_id_ano year &lt;SPAN class="token function"&gt;month&lt;/SPAN&gt; customer_status_numeric&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;1 2017 1 0
1 2017 2 0
1 2017 3 0
1 2017 4 0
1 2017 5 0
1 2017 6 1
1 2017 7 1
1 2017 8 0
1 2017 9 0
1 2017 10 1
1 2017 11 1
1 2017 12 0
2 2017 1 0
2 2017 2 0
2 2017 3 0
2 2017 4 1
2 2017 5 1
2 2017 6 1
2 2017 7 1
2 2017 8 1
2 2017 9 1
2 2017 10 0
2 2017 11 0
2 2017 12 0
3 2017 1 0
3 2017 2 0
3 2017 3 0
3 2017 4 0
3 2017 5 0
3 2017 6 0
3 2017 7 0
3 2017 8 0
3 2017 9 0
3 2017 10 0
3 2017 11 0
3 2017 12 0
4 2017 1 1
4 2017 2 1
4 2017 3 1
4 2017 4 1
4 2017 5 1
4 2017 6 1
4 2017 7 1
4 2017 8 0
4 2017 9 0
4 2017 10 0
4 2017 11 1
4 2017 12 1
5 2017 1 1
5 2017 2 1
5 2017 3 1
5 2017 4 1
5 2017 5 1
5 2017 6 1
5 2017 7 1
5 2017 8 1
5 2017 9 1
5 2017 10 1
5 2017 11 1
5 2017 12 1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I need a code that can perform the following task:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- When the variable customer_status_numeric turns into 1 I would like it to be 1 across the remaining following periods. In other words, as soon as customer_id _ano 1 turns into being 1 (customer_status_numeric=1) in June 2017 (as displayed in the data step above) I want him/her to stay 1 for the rest of the following months. Thus, customer_status_numeric should not turn into 0 in August 2017, but remain 1. And the same for the rest of the customers.&lt;BR /&gt;&lt;BR /&gt;I need this variable customer_status_numeric not to reset into 0 again once it has changed its value into 1.&lt;BR /&gt;&lt;BR /&gt;I hope I´ve provided you with a clear picture of what my issue is.&lt;BR /&gt;&lt;BR /&gt;Thank you in advance and do not hesitate to ask further questions if you need to!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 13:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-change-the-value-of-a-variable/m-p/378971#M3109</guid>
      <dc:creator>noemi_b</dc:creator>
      <dc:date>2017-07-25T13:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-change-the-value-of-a-variable/m-p/378977#M3110</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data have;
input customer_id_ano year month customer_status_numeric;
cards;
1 2017 1 0
1 2017 2 0
1 2017 3 0
1 2017 4 0
1 2017 5 0
1 2017 6 1
1 2017 7 1
1 2017 8 0
1 2017 9 0
1 2017 10 1
1 2017 11 1
1 2017 12 0
2 2017 1 0
2 2017 2 0
2 2017 3 0
2 2017 4 1
2 2017 5 1
2 2017 6 1
2 2017 7 1
2 2017 8 1
2 2017 9 1
2 2017 10 0
2 2017 11 0
2 2017 12 0
3 2017 1 0
3 2017 2 0
3 2017 3 0
3 2017 4 0
3 2017 5 0
3 2017 6 0
3 2017 7 0
3 2017 8 0
3 2017 9 0
3 2017 10 0
3 2017 11 0
3 2017 12 0
;
run;

data want (drop=customer_status_numeric rename=(c=customer_status_numeric));
  set have;
  by customer_id_ano;
  retain c;
  if first.customer_id_ano then c=0;
  if customer_status_numeric=1 then c=1;
run;

&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jul 2017 13:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-change-the-value-of-a-variable/m-p/378977#M3110</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-25T13:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-change-the-value-of-a-variable/m-p/378982#M3112</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;Exactly what I meant. Thank you!!!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 13:23:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-change-the-value-of-a-variable/m-p/378982#M3112</guid>
      <dc:creator>noemi_b</dc:creator>
      <dc:date>2017-07-25T13:23:37Z</dc:date>
    </item>
  </channel>
</rss>

