|
Dear Lister:
Could you tell me what might be the difference between two of the following SPSS syntax? Thanks! Hans Chen ============================== SELECT IF(CALC2=1). EXECUTE. ========================== USE ALL. COMPUTE filter_$=(CALC2=1). VARIABLE LABEL filter_$ 'CALC2=1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . ===================== 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 |
|
This is an empirical question that can be tested by actually running these
two pieces of syntax. SELECT IF permanently selects cases that are true and removes all others from the data file. Run it and you'll only have cases where calc=1. Here's what HELP says about SELECT IF: SELECT IF permanently selects cases for analysis based on logical conditions that are found in the data. These conditions are specified in a logical expression. The logical expression can contain relational operators, logical operators, arithmetic operations, and any functions that are allowed in COMPUTE transformations. For temporary case selection, specify a TEMPORARY command before SELECT IF. ------------------------------------------------------------------- FILTER passes cases whose value is not 0 or missing for the Filter variable to procedures. A filter can be turned off by USE ALL. Here's what HELP says about FILTER: FILTER is used to exclude cases from program procedures without deleting them from the active dataset. When FILTER is in effect, cases with a zero or missing value for the specified variable are not used in program procedures. Those cases are not actually deleted and are available again if the filter is turned off. To see the current filter status, use the SHOW command. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hans Chen Sent: Saturday, April 12, 2008 11:18 PM To: [hidden email] Subject: Re: Difference Between the Two Ways to Select Cases Dear Lister: Could you tell me what might be the difference between two of the following SPSS syntax? Thanks! Hans Chen ============================== SELECT IF(CALC2=1). EXECUTE. ========================== USE ALL. COMPUTE filter_$=(CALC2=1). VARIABLE LABEL filter_$ 'CALC2=1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . ===================== 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 |
|
One can also use SELECT IF in a temporary manner, with the TEMPORARY
command. TEMPORARY is in force until the next command forcing the data to be read, allowing several transformation commands to be used without modifying the working file on a more permanent basis. Example: TEMPORARY. SELECT IF AGE > 18. COMPUTE X = .... COMPUTE Y = ..... COMPUTE Z = ..... REGRESSION VARIABLES AGE X Y Z ......... CORRELATION AGE HEIGHT. In this example, the REGRESSION command applies only to subjects over 18 years old, and uses temporary variables X, Y and Z created only for this purpose. These variables do not remain in the working file. The effects of TEMPORARY finish with REGRESSION, which refers only to people over 18. The CORRELATION command applies to the entire data set (including ages above and below 18 years). Hector -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle Sent: 13 April 2008 10:20 To: [hidden email] Subject: Re: Difference Between the Two Ways to Select Cases This is an empirical question that can be tested by actually running these two pieces of syntax. SELECT IF permanently selects cases that are true and removes all others from the data file. Run it and you'll only have cases where calc=1. Here's what HELP says about SELECT IF: SELECT IF permanently selects cases for analysis based on logical conditions that are found in the data. These conditions are specified in a logical expression. The logical expression can contain relational operators, logical operators, arithmetic operations, and any functions that are allowed in COMPUTE transformations. For temporary case selection, specify a TEMPORARY command before SELECT IF. ------------------------------------------------------------------- FILTER passes cases whose value is not 0 or missing for the Filter variable to procedures. A filter can be turned off by USE ALL. Here's what HELP says about FILTER: FILTER is used to exclude cases from program procedures without deleting them from the active dataset. When FILTER is in effect, cases with a zero or missing value for the specified variable are not used in program procedures. Those cases are not actually deleted and are available again if the filter is turned off. To see the current filter status, use the SHOW command. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hans Chen Sent: Saturday, April 12, 2008 11:18 PM To: [hidden email] Subject: Re: Difference Between the Two Ways to Select Cases Dear Lister: Could you tell me what might be the difference between two of the following SPSS syntax? Thanks! Hans Chen ============================== SELECT IF(CALC2=1). EXECUTE. ========================== USE ALL. COMPUTE filter_$=(CALC2=1). VARIABLE LABEL filter_$ 'CALC2=1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . ===================== 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 |
|
I think it's not very good practice to use TEMPORARY, especially when doing
ad-hoc analyses interactively. I'd first use a DO IF to compute X, Y, and Z and then a filter to do the REGRESSION. I like the results of my transformations to be sticky and not disappear between data passes. -----Original Message----- From: Hector Maletta [mailto:[hidden email]] Sent: Sunday, April 13, 2008 9:29 AM To: 'ViAnn Beadle'; [hidden email] Subject: RE: Difference Between the Two Ways to Select Cases One can also use SELECT IF in a temporary manner, with the TEMPORARY command. TEMPORARY is in force until the next command forcing the data to be read, allowing several transformation commands to be used without modifying the working file on a more permanent basis. Example: TEMPORARY. SELECT IF AGE > 18. COMPUTE X = .... COMPUTE Y = ..... COMPUTE Z = ..... REGRESSION VARIABLES AGE X Y Z ......... CORRELATION AGE HEIGHT. In this example, the REGRESSION command applies only to subjects over 18 years old, and uses temporary variables X, Y and Z created only for this purpose. These variables do not remain in the working file. The effects of TEMPORARY finish with REGRESSION, which refers only to people over 18. The CORRELATION command applies to the entire data set (including ages above and below 18 years). Hector -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle Sent: 13 April 2008 10:20 To: [hidden email] Subject: Re: Difference Between the Two Ways to Select Cases This is an empirical question that can be tested by actually running these two pieces of syntax. SELECT IF permanently selects cases that are true and removes all others from the data file. Run it and you'll only have cases where calc=1. Here's what HELP says about SELECT IF: SELECT IF permanently selects cases for analysis based on logical conditions that are found in the data. These conditions are specified in a logical expression. The logical expression can contain relational operators, logical operators, arithmetic operations, and any functions that are allowed in COMPUTE transformations. For temporary case selection, specify a TEMPORARY command before SELECT IF. ------------------------------------------------------------------- FILTER passes cases whose value is not 0 or missing for the Filter variable to procedures. A filter can be turned off by USE ALL. Here's what HELP says about FILTER: FILTER is used to exclude cases from program procedures without deleting them from the active dataset. When FILTER is in effect, cases with a zero or missing value for the specified variable are not used in program procedures. Those cases are not actually deleted and are available again if the filter is turned off. To see the current filter status, use the SHOW command. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hans Chen Sent: Saturday, April 12, 2008 11:18 PM To: [hidden email] Subject: Re: Difference Between the Two Ways to Select Cases Dear Lister: Could you tell me what might be the difference between two of the following SPSS syntax? Thanks! Hans Chen ============================== SELECT IF(CALC2=1). EXECUTE. ========================== USE ALL. COMPUTE filter_$=(CALC2=1). VARIABLE LABEL filter_$ 'CALC2=1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . ===================== 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 |
|
However, ViAnn, TEMPORARY can be handy at times. I have been working with
very large data files which I do not want to make any larger. When I need some new variables for some specific analysis, and won't be using them again, TEMPORARY is a handy solution. Same for filter: when your filtering conditions are complex, you have first to create a (permanent) dummy filter variable with a COMPUTE or IF command, then use FILTER, then (possibly) delete the filtering dummy if you don't need it any more, whereas TEMPORARY makes all that far simpler. I think it is a matter of taste and convenience, and both ways are available. As for permanence, you may not retain the variables in the file, but you have the syntax and can apply it again and again, so nothing is lost, is it? Hector -----Original Message----- From: ViAnn Beadle [mailto:[hidden email]] Sent: 13 April 2008 12:54 To: 'Hector Maletta' Cc: [hidden email] Subject: RE: Difference Between the Two Ways to Select Cases I think it's not very good practice to use TEMPORARY, especially when doing ad-hoc analyses interactively. I'd first use a DO IF to compute X, Y, and Z and then a filter to do the REGRESSION. I like the results of my transformations to be sticky and not disappear between data passes. -----Original Message----- From: Hector Maletta [mailto:[hidden email]] Sent: Sunday, April 13, 2008 9:29 AM To: 'ViAnn Beadle'; [hidden email] Subject: RE: Difference Between the Two Ways to Select Cases One can also use SELECT IF in a temporary manner, with the TEMPORARY command. TEMPORARY is in force until the next command forcing the data to be read, allowing several transformation commands to be used without modifying the working file on a more permanent basis. Example: TEMPORARY. SELECT IF AGE > 18. COMPUTE X = .... COMPUTE Y = ..... COMPUTE Z = ..... REGRESSION VARIABLES AGE X Y Z ......... CORRELATION AGE HEIGHT. In this example, the REGRESSION command applies only to subjects over 18 years old, and uses temporary variables X, Y and Z created only for this purpose. These variables do not remain in the working file. The effects of TEMPORARY finish with REGRESSION, which refers only to people over 18. The CORRELATION command applies to the entire data set (including ages above and below 18 years). Hector -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle Sent: 13 April 2008 10:20 To: [hidden email] Subject: Re: Difference Between the Two Ways to Select Cases This is an empirical question that can be tested by actually running these two pieces of syntax. SELECT IF permanently selects cases that are true and removes all others from the data file. Run it and you'll only have cases where calc=1. Here's what HELP says about SELECT IF: SELECT IF permanently selects cases for analysis based on logical conditions that are found in the data. These conditions are specified in a logical expression. The logical expression can contain relational operators, logical operators, arithmetic operations, and any functions that are allowed in COMPUTE transformations. For temporary case selection, specify a TEMPORARY command before SELECT IF. ------------------------------------------------------------------- FILTER passes cases whose value is not 0 or missing for the Filter variable to procedures. A filter can be turned off by USE ALL. Here's what HELP says about FILTER: FILTER is used to exclude cases from program procedures without deleting them from the active dataset. When FILTER is in effect, cases with a zero or missing value for the specified variable are not used in program procedures. Those cases are not actually deleted and are available again if the filter is turned off. To see the current filter status, use the SHOW command. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hans Chen Sent: Saturday, April 12, 2008 11:18 PM To: [hidden email] Subject: Re: Difference Between the Two Ways to Select Cases Dear Lister: Could you tell me what might be the difference between two of the following SPSS syntax? Thanks! Hans Chen ============================== SELECT IF(CALC2=1). EXECUTE. ========================== USE ALL. COMPUTE filter_$=(CALC2=1). VARIABLE LABEL filter_$ 'CALC2=1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . ===================== 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 |
|
Dear List,
I am working with a large longitudinal data set, that has an age variable but it only gives the year of birth, and I would like to figure out the age of subjects during one of the waves of data collection. Does anyone have an example of syntax that can help me do this? All suggestions are welcomed, Stace __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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 |
|
I am not sure what th eproblem is. Do you have a variable that
identifies the year of the wave? In that case it is simply: comute age=waveyear-birthyear. Ruben stace swayne wrote: > Dear List, > > I am working with a large longitudinal data set, that has an age variable but > it only gives the year of birth, and I would like to figure out the age of subjects during one of the waves of data collection. > Does anyone have an example of syntax that can help me do this? > > All suggestions are welcomed, > > Stace > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.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 > -- Dr. Ruben P. Konig Department of Communication telephone +31 24 3615789/3612372 Radboud University Nijmegen telefax +31 24 3613073 P. O. Box 9104 6500 HE Nijmegen [hidden email] The Netherlands http://oase.uci.kun.nl/~rkonig ===================== 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 |
|
Hi,
In the menu, have a look at Transform --> Date/Time... --> Calculate with dates and times You can use 'paste' to save the syntax. Cheers!! Albert-Jan --- "Ruben P. Konig" <[hidden email]> wrote: > I am not sure what th eproblem is. Do you have a > variable that > identifies the year of the wave? In that case it is > simply: > comute age=waveyear-birthyear. > > Ruben > > stace swayne wrote: > > Dear List, > > > > I am working with a large longitudinal data set, > that has an age variable but > > it only gives the year of birth, and I would like > to figure out the age of subjects during one of the > waves of data collection. > > Does anyone have an example of syntax that can > help me do this? > > > > All suggestions are welcomed, > > > > Stace > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.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 > > > > -- > Dr. Ruben P. Konig > Department of Communication telephone +31 24 > 3615789/3612372 > Radboud University Nijmegen telefax +31 24 > 3613073 > P. O. Box 9104 > 6500 HE Nijmegen [hidden email] > The Netherlands > http://oase.uci.kun.nl/~rkonig > > ===================== > 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 > ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ===================== 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 |
