<?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 values of a variable? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/570939#M12059</link>
    <description>&lt;P&gt;Welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input company $ variable $;
datalines;
A asset1
A asset2
A asset3
A asset4
B asset1
B asset2
B asset3
C asset1
C asset2
C asset3
C asset4
D asset1
D asset2
D asset3
;

data want;
    set have;
    newvar=sum(input(compress(variable, '', 'kd'), 8.), 1999);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Jul 2019 12:13:55 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-07-03T12:13:55Z</dc:date>
    <item>
      <title>how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/570934#M12057</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am working on SAS 9.4 version. I need help on changing the values of a variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to replace asset1 with 2000, asset2 with 2001, asset3 with 2002 and so on. it is unbalanced panel data of around 5000 companies with 19 years of time series observations from the year 2000 to 2018 My data set is like as follows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;company&amp;nbsp; &amp;nbsp;variable&amp;nbsp;&lt;/P&gt;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t;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;asset2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;asset3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 12:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/570934#M12057</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2019-07-03T12:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/570938#M12058</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newvar = 1999 + input(substr(variable,6),best.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jul 2019 12:13:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/570938#M12058</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-03T12:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/570939#M12059</link>
      <description>&lt;P&gt;Welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input company $ variable $;
datalines;
A asset1
A asset2
A asset3
A asset4
B asset1
B asset2
B asset3
C asset1
C asset2
C asset3
C asset4
D asset1
D asset2
D asset3
;

data want;
    set have;
    newvar=sum(input(compress(variable, '', 'kd'), 8.), 1999);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jul 2019 12:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/570939#M12059</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-03T12:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571187#M12120</link>
      <description>&lt;P&gt;thanks a lot. the code is working excellently.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 09:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571187#M12120</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2019-07-04T09:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571346#M12154</link>
      <description>&lt;P&gt;dear&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304" target="_self"&gt;&lt;SPAN class="login-bold"&gt;draycut&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;can you please tell me know to change the code when i have 25 observations for each company?&lt;/P&gt;&lt;P&gt;thanks in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2019 10:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571346#M12154</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2019-07-05T10:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571349#M12156</link>
      <description>&lt;P&gt;Have you tried the code with 25 obs per company? If yes, where did the result not meet your expectations?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2019 10:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571349#M12156</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-05T10:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571596#M12205</link>
      <description>&lt;P&gt;yes. I tried. but all the observations of each&amp;nbsp; company are getting the value of '1999' only.&amp;nbsp;&lt;/P&gt;&lt;P&gt;my data starts at the year 1994 and ends at 2018.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly help me in changing the&amp;nbsp; previously used code to get the desired output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jul 2019 18:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571596#M12205</guid>
      <dc:creator>srikanthyadav44</dc:creator>
      <dc:date>2019-07-06T18:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to change values of a variable?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571601#M12208</link>
      <description>&lt;P&gt;Since &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;'s code DOES work (just run it), your data must be different than what you showed in your initial post. Please post correct example data in a data step with datalines, as seen in &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;'s post.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jul 2019 19:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-values-of-a-variable/m-p/571601#M12208</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-06T19:34:05Z</dc:date>
    </item>
  </channel>
</rss>

