BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can anyone suggest the method for me to me to take logarithm on divided of two observation, e.g. log(VariableX/VariableX[n+1])that like Excel?
Example, =log(A10/A11).
My Constraint is huge amount of data that cannot process in Excel.
2 REPLIES 2
David_SAS
SAS Employee
This question is perhaps best answered by Technical Support. You can enter it online at http://support.sas.com/ctx/supportform/index.jsp .

-- David Kelley, SAS
Olivier
Pyrite | Level 9
In SAS, you can't read the value of the next line... but you can use the value of the previous line.
So in a Data step, compute a new variable, the formula of which will be :
LOG(LAG(X)/X) ;

The LAG function returns the value for variable X on the previously read observation.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1125 views
  • 0 likes
  • 3 in conversation