BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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?
1 REPLY 1
deleted_user
Not applicable
couple of ways come to mind

1) in a code segment
[pre]
data outdata;
set indata;
B = log(A); *--- this is a natural log (ln) by the way, not a base 10 log;
C = log10(A);
run;
quit;
[/pre]

2) as a computed value in a query
"drag" or place or double-click on the input dataset to add it to your project
right-click on the dataset
select Filter or Query ... from the popup menu
drag the variable A over to the selected tab panel/window/field_box
click on Computed Columns (above and slightly left of the list of variables in the input datasets)
click on New
Select Build Expression ...
enter into the top frame (Expression text:) log10()
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.
Click Ok
Highlight "Calculated1"
Click Rename
Change the name to "B"
Click Close

The rest should be self-evident.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 5292 views
  • 0 likes
  • 1 in conversation