I've written the following syntax to interleave two files:
ADD FILES FILE = "X" /FILE = "Y" /BY ID SAVE OUTFILE = "Z". The interleaving was completed but the data are in two columns. How do I merge these two columns into one? 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 |
If you are trying to, essentially, run an update query on your data, I believe the solution is to merge the two data columns into a new data column. It depends on the known properties what you do. If there is a possibility that two data columns could both have data, and the data could be different, that complicates things. Let's assume that you have cases that ether have the data or don't, and the new data file contains an update. My solution is simply to add the two variables together into a new third variable. Essentially the logic is 1+missing=1 in this case, so there is no reason this isn't possible. If you want, you can also create if statements that indicate that the third variable V3 is equal to V1 or V2, depending on which one is not missing. I use do if loops for that.
What you're doing below is attempting to add variables to existing cases (that's the assumption SPSS is making) when in fact, for that variable, the case is actually missing, and you actually need to add cases to variables. Hence why I use the above approach instead. Might I add, I do think there are other programs better suited to this level of data management, namely, SQL, even Access, and would suggest that as a better approach. I use the above approach only when in a pinch or working quickly, if I need to make updates on a regular basis, I do this in a database. Matthew J Poes Research Data Specialist Center for Prevention Research and Development University of Illinois 510 Devonshire Dr. Champaign, IL 61820 Phone: 217-265-4576 email: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Matt Freeman Sent: Friday, July 13, 2012 4:24 PM To: [hidden email] Subject: Interleaving Cases within the same file I've written the following syntax to interleave two files: ADD FILES FILE = "X" /FILE = "Y" /BY ID SAVE OUTFILE = "Z". The interleaving was completed but the data are in two columns. How do I merge these two columns into one? 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 |
Administrator
|
In reply to this post by Matt Freeman
What variables are in files X and Y? Presumably both have a variable called ID. But what other variables do they have? Include whether they are numeric or string, etc.
--
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/). |
Administrator
|
In reply to this post by Matt Freeman
You do realize that you have left out CRUCIAL INFORMATION!!!
I'm going to let you guess what we might need to be able to help? I don't do ESP on Fridays anymore. -----------------------------------
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
I suppose InterneTelepathy is out of the question then too, is it? :-|
--
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/). |
Administrator
|
Yeah, I turn off all the spooky shit at midnight on Thursdays!
It's almost Beer-O'Clock and the two just don't mix. ---- OP see RENAME subcmd? see MAX? YMMV!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by Poes, Matthew Joseph
Matt,
If what you are attempting is something like File X ID Var1 1 A 3 C File Y ID Var1 2 B 4 D To make: File Z ID Var1 1 A 2 B 3 C 4 D Then the syntax you wrote should work, but it sounds like you are getting: File Z ID Var1 Var2 <---it would help to know more about what the file you are getting looks like (what does 'in two columns' actually mean?) 1 A . 2 . B 3 C . 4 . D If this is so, I would check the variable names and formats in File X and File Y as it seems like something is different. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Poes, Matthew Joseph Sent: Friday, July 13, 2012 4:55 PM To: [hidden email] Subject: Re: [SPSSX-L] Interleaving Cases within the same file If you are trying to, essentially, run an update query on your data, I believe the solution is to merge the two data columns into a new data column. It depends on the known properties what you do. If there is a possibility that two data columns could both have data, and the data could be different, that complicates things. Let's assume that you have cases that ether have the data or don't, and the new data file contains an update. My solution is simply to add the two variables together into a new third variable. Essentially the logic is 1+missing=1 in this case, so there is no reason this isn't possible. If you want, you can also create if statements that indicate that the third variable V3 is equal to V1 or V2, depending on which one is not missing. I use do if loops for that. What you're doing below is attempting to add variables to existing cases (that's the assumption SPSS is making) when in fact, for that variable, the case is actually missing, and you actually need to add cases to variables. Hence why I use the above approach instead. Might I add, I do think there are other programs better suited to this level of data management, namely, SQL, even Access, and would suggest that as a better approach. I use the above approach only when in a pinch or working quickly, if I need to make updates on a regular basis, I do this in a database. Matthew J Poes Research Data Specialist Center for Prevention Research and Development University of Illinois 510 Devonshire Dr. Champaign, IL 61820 Phone: 217-265-4576 email: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Matt Freeman Sent: Friday, July 13, 2012 4:24 PM To: [hidden email] Subject: Interleaving Cases within the same file I've written the following syntax to interleave two files: ADD FILES FILE = "X" /FILE = "Y" /BY ID SAVE OUTFILE = "Z". The interleaving was completed but the data are in two columns. How do I merge these two columns into one? 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 PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. ===================== 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 |