Skip to content
Back to formatted view

Raw Message

Message-ID: <9dd0a87c0901112357j1e0dc4acp70b4acb97d1aa65d@mail.gmail.com>
Date: 2009-01-12T07:57:42Z
From: Heston Capital
Subject: How to reference previous row?

I am trying to write some code where the factor references its
previous value, but can't find a solution searching through the
archive.

> X
  first second	
1     A      1
2     A      2
3     B      3
4     B      4
5     B      5
6     C      6
7     C      7

I need a third column, in pseudo code-
 If value of first=previous value of first:
	third=previous value of third
 else third = second

So the third column would look like:
0
0
3
3
3
6
6


Thanks!