Is your data long (3 records with FEV1 for each id)? Please provide sample data.
Jim Marks Sr. Manager, Market Research KFHP, MAS 2101 E Jefferson St Rockville, MD. 20852 > On Nov 27, 2019, at 8:14 AM, Sigrid Vikjord <[hidden email]> wrote: > > Caution: This email came from outside Kaiser Permanente. Do not open attachments or click on links if you do not recognize the sender. > > ______________________________________________________________________ > Hi, > > I have two variables; FEV1 and id. The FEV1 variable is numeric (5.45, 3.28 > etc.) and contains three measurements per id. Does anyone have ideas for a > syntax that creates a variable "FEV1_best" that contains the highest > measurement of FEV1 for each id? > > I'm using SPSS 25. > > > > > > -- > Sent from: https://urldefense.com/v3/__http://spssx-discussion.1045642.n5.nabble.com/__;!7TrXCGkIugIq!-MOC0JRy3x3gaTQLXx3yj7KhOO4Z2LPhCUWgzrQ8OgKRBS8sdQphBlO_NUMHLOk$ > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
You can do this with AGGREGATE, AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=id /FEV1_MAX=MAX(FEV1). On Wed, Nov 27, 2019 at 6:14 AM Sigrid Vikjord <[hidden email]> wrote: Hi, |
In reply to this post by Jim Marks
Use command AGGREGATE, e.g. AGGREGATE OUTFILE * MODE = ADDVARIABLES /BREAK id /Fev1_best = MAX(Fev1). Mario Giesel Munich, Germany
Am Mittwoch, 27. November 2019, 14:40:25 MEZ hat Jim Marks <[hidden email]> Folgendes geschrieben:
Is your data long (3 records with FEV1 for each id)? Please provide sample data. Jim Marks Sr. Manager, Market Research KFHP, MAS 2101 E Jefferson St Rockville, MD. 20852 > On Nov 27, 2019, at 8:14 AM, Sigrid Vikjord <[hidden email]> wrote: > > Caution: This email came from outside Kaiser Permanente. Do not open attachments or click on links if you do not recognize the sender. > > ______________________________________________________________________ > Hi, > > I have two variables; FEV1 and id. The FEV1 variable is numeric (5.45, 3.28 > etc.) and contains three measurements per id. Does anyone have ideas for a > syntax that creates a variable "FEV1_best" that contains the highest > measurement of FEV1 for each id? > > I'm using SPSS 25. > > > > > > -- > Sent from: https://urldefense.com/v3/__http://spssx-discussion.1045642.n5.nabble.com/__;!7TrXCGkIugIq!-MOC0JRy3x3gaTQLXx3yj7KhOO4Z2LPhCUWgzrQ8OgKRBS8sdQphBlO_NUMHLOk$ > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Jim Marks
Your issue is sorted out?
-- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Jim Marks
The less trivial question is how to add a bunch of variables
to all records, picking those from the record where FEV1 is
the maximum.
For that, you can presort on FEV1 using Descending order,
instead of the default Ascending. Then use Aggregate
(Presorted) to pick up the FIRST( ) for each of the other vars.
And the AddVars option, to keep all the records.
--
Rich Ulrich
From: SPSSX(r) Discussion <[hidden email]> on behalf of Sigrid Vikjord <[hidden email]>
Sent: Wednesday, November 27, 2019 5:18 AM To: [hidden email] <[hidden email]> Subject: Choosing highest value of a variable for each id Hi,
I have two variables; FEV1 and id. The FEV1 variable is numeric (5.45, 3.28 etc.) and contains three measurements per id. Does anyone have ideas for a syntax that creates a variable "FEV1_best" that contains the highest measurement of FEV1 for each id? I'm using SPSS 25. -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Why not just use MAX in AGGREGATE? On Fri, Feb 14, 2020 at 11:21 AM Rich Ulrich <[hidden email]> wrote:
|
MAX in Aggregate will pick up the max for each of the
vars, separately. Trivial, read the fine manual. I was
describing the problem of picking up all variables from
that one particular record where FEV1 was max.
--
Rich Ulrich
From: Jon Peck <[hidden email]>
Sent: Friday, February 14, 2020 1:44 PM To: Rich Ulrich <[hidden email]> Cc: SPSS List <[hidden email]> Subject: Re: [SPSSX-L] Choosing highest value of a variable for each id Why not just use MAX in AGGREGATE?
On Fri, Feb 14, 2020 at 11:21 AM Rich Ulrich <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |