The SAS Output Delivery System and reporting techniques

Problems about take logarithm in two obs. in single variable

Reply
N/A
Posts: 0

Problems about take logarithm in two obs. in single variable

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.
SAS Employee
Posts: 174

Re: Problems about take logarithm in two obs. in single variable

Posted in reply to deleted_user
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
Super Contributor
Posts: 260

Re: Problems about take logarithm in two obs. in single variable

Posted in reply to deleted_user
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.
Ask a Question
Discussion stats
  • 2 replies
  • 123 views
  • 0 likes
  • 3 in conversation