<?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: change variable values in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/change-variable-values/m-p/747794#M29498</link>
    <description>&lt;P&gt;Not sure about easy, but for such simple arithmetic you could use the RESOLVE() function to take advantage of the power of the macro processing language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  gestational_age = "32+2 weeks" ;
  expression=scan(gestational_age,1,' ');
  age = input(resolve(cats('%sysevalf(',expression,')')),32.);
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;       gestational_
Obs        age         expression    age

 1      32+2 weeks        32+2        34
&lt;/PRE&gt;</description>
    <pubDate>Mon, 14 Jun 2021 13:18:54 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-06-14T13:18:54Z</dc:date>
    <item>
      <title>change variable values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/change-variable-values/m-p/747778#M29497</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable "gestational_age" in the data set decoded as, for example, "32+2 weeks". How can I easily convert it to a numeric variable and add the first number to the second one , turning the value into "34" instead of 32+2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 12:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/change-variable-values/m-p/747778#M29497</guid>
      <dc:creator>skargae</dc:creator>
      <dc:date>2021-06-14T12:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: change variable values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/change-variable-values/m-p/747794#M29498</link>
      <description>&lt;P&gt;Not sure about easy, but for such simple arithmetic you could use the RESOLVE() function to take advantage of the power of the macro processing language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  gestational_age = "32+2 weeks" ;
  expression=scan(gestational_age,1,' ');
  age = input(resolve(cats('%sysevalf(',expression,')')),32.);
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;       gestational_
Obs        age         expression    age

 1      32+2 weeks        32+2        34
&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jun 2021 13:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/change-variable-values/m-p/747794#M29498</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-14T13:18:54Z</dc:date>
    </item>
  </channel>
</rss>

