SugarAddict
SugarAddict

Reputation: 11

How to reference a specific row in the "compute variable" dialog of SPSS?

This is my problem:
I have a table of measured fluorescence values depending on a drug concentration. I can't use the values directly, because even in absence of drug, there is some small fluorescence. Consequently, I have to substract the value from the drug=0 measurement from all other values.

I figured I could calculate a new variable (normalized fluorescence), but how do I reference to the fluorescence value in the drug=0 row? In excel, I'd use sth like $34$2 to reference to that field, but how to do that in SPSS? Entering the value "hard-coded" seems a bit unflexible, and I wanna know how to do it by reference :). Hours of googling and reading in books have yielded no answer so far.

Thanks :)

Edit: An example would be

Drug conc.  | Fluorescence
0           | 0.1  <- this value is to be substracted from all fluo values
1           | 1.1
2           | 2.1
3           | 3.1
4           | 4.1

Upvotes: 1

Views: 262

Answers (1)

djhurio
djhurio

Reputation: 5536

Constant in SPSS can be represented as a variable with the same value for all rows. So you have to make a new variable with value of Fluorescence when drug=0. Example:

data list free
 /drug (f8) Fluorescence (f8.1).
begin data
0 0.1
1 1.1
2 2.1
3 3.1
4 4.1
end data.

sort cases drug.

do if drug = 0.
comp const = Fluorescence.
else.
comp const = lag(const).
end if.

exe.

comp Fluorescence2 = Fluorescence - const.

form const Fluorescence2 (f8.1).

exe.

Upvotes: 2

Related Questions