|
Hello, I have been able to make the syntax work in previous files, but now it doesn’t seem to work anymore. I can’t figure out what has changed. I have a file of several million cases, arranged by identification number and year/qtr, along with race and ethnicity fields which were merged from another file. Race/ethnicity is included in the first instance of the identification number, but not on subsequent cases. I need to add the Race/ethnicity information to each case that has the same identification number. The syntax I used successfully before was
if (Recip_ID eq lag(Recip_ID)) and Missing(Race) Race=lag(Race). if (Recip_ID eq lag(Recip_ID) and Missing(Ethnicity)) Ethnicity=lag(Ethnicity). execute.
Now when I attempt this, nothing happens. I don’t get an error message, just nothing changes. I am sending an example of the file below:
Yr/qtr Recip_ID DOB Race Ethnicity
20082 000000500 19580803 1 1 20083 000000500 19580803 20084 000000500 19580803 20091 000000500 19580803 000000602 5 1 000000800 5 1 20082 000000826 19660601 5 1 20083 000000826 19660601 20083 000000826 19660601 20084 000000826 19660601 20091 000000826 19660601 20092 000000826 19660601
this is what I want the result to be:
Yr/qtr Recip_ID DOB Race Ethnicity
20082 000000500 19580803 1 1 20083 000000500 19580803 1 1 20084 000000500 19580803 1 1 20091 000000500 19580803 1 1 000000602 5 1 000000800 5 1 20082 000000826 19660601 5 1 20083 000000826 19660601 5 1 20083 000000826 19660601 5 1 20084 000000826 19660601 5 1 20091 000000826 19660601 5 1 20092 000000826 19660601 5 1
I would appreciate your input on this. Can you see what I am doing wrong?
Vicki L. Stirkey Program Analyst 3 OMHSAS Office of Mental Health and Substance Abuse Services Division of Systems Management 717-705-8198 Fax: 717-772-6737
|
|
Administrator
|
I don't see anything wrong with the code--and as you say, it worked before on another file. That makes me wonder if the problem is with the ID variable. Is it string or numeric? My guess is it's string, and that the values don't match exactly. You could try something like this before running your code: compute Recip_ID = ltrim(rtrim(Recip_ID)). exe. Alternatively, you could recode ID to a numeric variable, and use the numeric ID variable in your syntax.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
|
Another thought: are you sure that the transformations have actually been executed? The evil EXECUTE command or a data pass triggered by something else would be needed for the changes to show up in the Data Editor.
Regards, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver Sent: Monday, October 05, 2009 12:08 PM To: [hidden email] Subject: Re: [SPSSX-L] Lag Function Stirkey, Vicki wrote: > > Hello, I have been able to make the syntax work in previous files, but now > it doesn't seem to work anymore. I can't figure out what has changed. > I have a file of several million cases, arranged by identification number > and year/qtr, along with race and ethnicity fields which were merged from > another file. Race/ethnicity is included in the first instance of the > identification number, but not on subsequent cases. I need to add the > Race/ethnicity information to each case that has the same identification > number. > The syntax I used successfully before was > > if (Recip_ID eq lag(Recip_ID)) and Missing(Race) Race=lag(Race). > if (Recip_ID eq lag(Recip_ID) and Missing(Ethnicity)) > Ethnicity=lag(Ethnicity). > execute. > > Now when I attempt this, nothing happens. I don't get an error message, > just nothing changes. I am sending an example of the file below: > > Yr/qtr Recip_ID DOB Race Ethnicity > > 20082 000000500 19580803 1 1 > 20083 000000500 19580803 > 20084 000000500 19580803 > 20091 000000500 19580803 > 000000602 5 1 > 000000800 5 1 > 20082 000000826 19660601 5 1 > 20083 000000826 19660601 > 20083 000000826 19660601 > 20084 000000826 19660601 > 20091 000000826 19660601 > 20092 000000826 19660601 > > > this is what I want the result to be: > > Yr/qtr Recip_ID DOB Race Ethnicity > > 20082 000000500 19580803 1 1 > 20083 000000500 19580803 1 1 > 20084 000000500 19580803 1 1 > 20091 000000500 19580803 1 1 > 000000602 5 1 > 000000800 5 1 > 20082 000000826 19660601 5 1 > 20083 000000826 19660601 5 1 > 20083 000000826 19660601 5 1 > 20084 000000826 19660601 5 1 > 20091 000000826 19660601 5 1 > 20092 000000826 19660601 5 1 > > I would appreciate your input on this. Can you see what I am doing wrong? > > I don't see anything wrong with the code--and as you say, it worked before on another file. That makes me wonder if the problem is with the ID variable. Is it string or numeric? My guess is it's string, and that the values don't match exactly. You could try something like this before running your code: compute Recip_ID = ltrim(rtrim(Recip_ID)). exe. Alternatively, you could recode ID to a numeric variable, and use the numeric ID variable in your syntax. ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://www.nabble.com/Lag-Function-tp25753651p25755217.html Sent from the SPSSX Discussion mailing list archive at 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 ===================== 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 everybody,
Can we force the orthogonal design to generate only 16 cards? Regards Girish ===================== 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 Stirkey, Vicki
Vicki
You have misplaced a close bracket in your first
statement. Could this be causing the problem?
Garry Gelade
Business Analytic Ltd. From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Stirkey, Vicki Sent: 05 October 2009 17:08 To: [hidden email] Subject: Lag Function Hello, I have been able to make the syntax work in previous files, but now it doesn’t seem to work anymore. I can’t figure out what has changed. I have a file of several million cases, arranged by identification number and year/qtr, along with race and ethnicity fields which were merged from another file. Race/ethnicity is included in the first instance of the identification number, but not on subsequent cases. I need to add the Race/ethnicity information to each case that has the same identification number. The syntax I used successfully before was
if (Recip_ID eq lag(Recip_ID)) and Missing(Race) Race=lag(Race). if (Recip_ID eq lag(Recip_ID) and Missing(Ethnicity)) Ethnicity=lag(Ethnicity). execute.
Now when I attempt this, nothing happens. I don’t get an error message, just nothing changes. I am sending an example of the file below:
Yr/qtr Recip_ID DOB Race Ethnicity
20082 000000500 19580803 1 1 20083 000000500 19580803 20084 000000500 19580803 20091 000000500 19580803 000000602 5 1 000000800 5 1 20082 000000826 19660601 5 1 20083 000000826 19660601 20083 000000826 19660601 20084 000000826 19660601 20091 000000826 19660601 20092 000000826 19660601
this is what I want the result to be:
Yr/qtr Recip_ID DOB Race Ethnicity
20082 000000500 19580803 1 1 20083 000000500 19580803 1 1 20084 000000500 19580803 1 1 20091 000000500 19580803 1 1 000000602 5 1 000000800 5 1 20082 000000826 19660601 5 1 20083 000000826 19660601 5 1 20083 000000826 19660601 5 1 20084 000000826 19660601 5 1 20091 000000826 19660601 5 1 20092 000000826 19660601 5 1
I would appreciate your input on this. Can you see what I am doing wrong?
Vicki L. Stirkey Program Analyst 3 OMHSAS Office of Mental Health and Substance Abuse Services Division of Systems Management 717-705-8198 Fax: 717-772-6737
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4482 (20091005) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4482 (20091005) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com |
|
Administrator
|
Well spotted, Garry!
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
|
We've all done it, but less publicly!
|
|
In reply to this post by Bruce Weaver
I suspect this is wishful thinking, but is there a way to turn syntax back
into dialog? As I'm learning syntax my process is to us the dialog boxes for guidance and then make tweaks, replicate, etc. But I still have to start over when I restart SPSS or need to do different procedures. Thanks --Mike ===================== 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 |
|
That is a great suggestion. I could see it being applied to the analytic procedures, however I suspect it may be more challenging on the transformation dialogs.
On 07/10/2009 3:31pm, Mike Pritchard <[hidden email]> wrote: > I suspect this is wishful thinking, but is there a way to turn syntax back > > > into dialog? > > > > > > As I'm learning syntax my process is to us the dialog boxes for guidance and > > > then make tweaks, replicate, etc. But I still have to start over when I > > > restart SPSS or need to do different procedures. > > > > > > Thanks > > > --Mike > > > > > > ===================== > > > 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 |
