|
Dear All,
I use SPSS 15. I want to know if there is a function like Lag but moves forward? I want to check for the value of next case(s) in an wasy way Thanks ===================== 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 |
|
I'm not sure if there is a built-in function which does this (there may well
be). A workaround could be (untested) to create a temp id variable and then sort this descending i.e. just reversing the ordering of your dataset. You can now use the lag function as you intended and then sort by id (ascending) when finished with your transformations to get the file back in its original order. Would this work? HTH. Jigs 2008/12/15 Mona Ararat <[hidden email]> > Dear All, > > I use SPSS 15. > > I want to know if there is a function like Lag but moves forward? > I want to check for the value of next case(s) in an wasy way > > > Thanks > > ===================== > 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 Mona Ararat
Hi Mona
Make first a sortable variable (such as case numbers), then sort the data in a descending way. That will place the value that was previously 'next' now to 'before' and you can use the Lag function as usual. COMPUTE sorter = $Casenum. SORT CASES by sorter (D). Hope this helps, Christian ********************************** Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 CH-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:[hidden email] Web: www.lavolta.ch -----Ursprüngliche Nachricht----- Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Mona Ararat Gesendet: Montag, 15. Dezember 2008 10:54 An: [hidden email] Betreff: Next Case Observation Dear All, I use SPSS 15. I want to know if there is a function like Lag but moves forward? I want to check for the value of next case(s) in an wasy way Thanks ===================== 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 |
|
It won't help with version 15, but version 17 has a new command, SHIFT VALUES, that handles both leads and lags and that deals more intuitively with the tricky issues surrounding split files and gaps in the selected cases than does the LAG function.
Here is the Operations section of the SHIFT VALUES help. (The command always generates a new variable.) If split file processing is on, the scope of the shift is limited to each split group. A shift value cannot be obtained from a case in a preceding or subsequent split group. Filter status is ignored. The value of the result variable is set to system-missing for the first or last n cases in the dataset or split group, where n is the number of cases specified on LEAD, LAG, or SHIFT. For example, LAG=1 would set the result variable to system-missing for the first case in the dataset (or first case in each split group). A value of 0 for number of cases will copy the value of the original value to the same case for the new variable. User-missing values are preserved. Dictionary information from the original variable, including defined value labels and user-missing value assignments, is applied to the new variable. (Note: Custom variable attributes are not included.) A variable label is automatically generated for the new variable that describes the shift operation that created the variable. Regards, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la volta statistics Sent: Monday, December 15, 2008 3:50 AM To: [hidden email] Subject: [SPSSX-L] AW: Next Case Observation Hi Mona Make first a sortable variable (such as case numbers), then sort the data in a descending way. That will place the value that was previously 'next' now to 'before' and you can use the Lag function as usual. COMPUTE sorter = $Casenum. SORT CASES by sorter (D). Hope this helps, Christian ********************************** Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 CH-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:[hidden email] Web: www.lavolta.ch -----Ursprüngliche Nachricht----- Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Mona Ararat Gesendet: Montag, 15. Dezember 2008 10:54 An: [hidden email] Betreff: Next Case Observation Dear All, I use SPSS 15. I want to know if there is a function like Lag but moves forward? I want to check for the value of next case(s) in an wasy way Thanks ===================== 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 ===================== 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 Mona Ararat
The CREATE compute a lead value. Note that this is not a transformation but
is a procedure and will read the entire variable vector into memory. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mona Ararat Sent: Monday, December 15, 2008 2:54 AM To: [hidden email] Subject: Next Case Observation Dear All, I use SPSS 15. I want to know if there is a function like Lag but moves forward? I want to check for the value of next case(s) in an wasy way Thanks ===================== 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 Mona Ararat
Thank you all for your suggestions, the Casenumber and sorting things seem
to be fine. Actually when it comes to having complicated calculations or data editing one dreams of more flexibility! Thank you all ===================== 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 |
| Free forum by Nabble | Edit this page |
