<?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 new variable from an existing variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-new-variable-from-an-existing-variable/m-p/14957#M2986</link>
    <description>couple of ways come to mind&lt;BR /&gt;
&lt;BR /&gt;
1) in a code segment&lt;BR /&gt;
[pre]&lt;BR /&gt;
data outdata;&lt;BR /&gt;
  set indata;&lt;BR /&gt;
    B = log(A);  *--- this is a natural log (ln) by the way, not a base 10 log;&lt;BR /&gt;
    C = log10(A);&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
2) as a computed value in a query&lt;BR /&gt;
"drag" or place or double-click on the input dataset to add it to your project&lt;BR /&gt;
right-click on the dataset&lt;BR /&gt;
select Filter or Query ... from the popup menu&lt;BR /&gt;
drag the variable A over to the selected tab panel/window/field_box&lt;BR /&gt;
click on Computed Columns (above and slightly left of the list of variables in the input datasets)&lt;BR /&gt;
click on New&lt;BR /&gt;
Select Build Expression ...&lt;BR /&gt;
enter into the top frame (Expression text:)   log10()&lt;BR /&gt;
in between the parenthises, click to place the cursor, then from the right lower frame of the dialog box select variable A.  Be sure you do it from the right side and not the left side.&lt;BR /&gt;
Click Ok&lt;BR /&gt;
Highlight "Calculated1"&lt;BR /&gt;
Click Rename&lt;BR /&gt;
Change the name to "B"&lt;BR /&gt;
Click Close&lt;BR /&gt;
&lt;BR /&gt;
The rest should be self-evident.</description>
    <pubDate>Wed, 30 Apr 2008 21:00:55 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-04-30T21:00:55Z</dc:date>
    <item>
      <title>Create new variable from an existing variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-new-variable-from-an-existing-variable/m-p/14956#M2985</link>
      <description>I have a variable named A. I want to create a variable B wich is equal to LOG(A). How can I do this in SAS Enterprise Guide?</description>
      <pubDate>Wed, 30 Apr 2008 20:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-new-variable-from-an-existing-variable/m-p/14956#M2985</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-30T20:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create new variable from an existing variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-new-variable-from-an-existing-variable/m-p/14957#M2986</link>
      <description>couple of ways come to mind&lt;BR /&gt;
&lt;BR /&gt;
1) in a code segment&lt;BR /&gt;
[pre]&lt;BR /&gt;
data outdata;&lt;BR /&gt;
  set indata;&lt;BR /&gt;
    B = log(A);  *--- this is a natural log (ln) by the way, not a base 10 log;&lt;BR /&gt;
    C = log10(A);&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
2) as a computed value in a query&lt;BR /&gt;
"drag" or place or double-click on the input dataset to add it to your project&lt;BR /&gt;
right-click on the dataset&lt;BR /&gt;
select Filter or Query ... from the popup menu&lt;BR /&gt;
drag the variable A over to the selected tab panel/window/field_box&lt;BR /&gt;
click on Computed Columns (above and slightly left of the list of variables in the input datasets)&lt;BR /&gt;
click on New&lt;BR /&gt;
Select Build Expression ...&lt;BR /&gt;
enter into the top frame (Expression text:)   log10()&lt;BR /&gt;
in between the parenthises, click to place the cursor, then from the right lower frame of the dialog box select variable A.  Be sure you do it from the right side and not the left side.&lt;BR /&gt;
Click Ok&lt;BR /&gt;
Highlight "Calculated1"&lt;BR /&gt;
Click Rename&lt;BR /&gt;
Change the name to "B"&lt;BR /&gt;
Click Close&lt;BR /&gt;
&lt;BR /&gt;
The rest should be self-evident.</description>
      <pubDate>Wed, 30 Apr 2008 21:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-new-variable-from-an-existing-variable/m-p/14957#M2986</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-30T21:00:55Z</dc:date>
    </item>
  </channel>
</rss>

