|
Dear colisters: I believe this is a fairly easy question, and I believe I have done this before, but I find myself stuck with this and can't get this done. I have a dataset looks similar like this Id age gender question answer a 15.00 F 1.00 1.00 a 15.00 F 5.00 1.00 a 15.00 F 8.00 1.00 a 15.00 F 10.00 1.00 b 25.00 m 2.00 1.00 b 25.00 m 4.00 1.00 b 25.00 m 5.00 1.00 b 25.00 m 7.00 1.00 b 25.00 m 8.00 1.00 b 25.00 m 9.00 1.00 there are 10 questions in tatal, and only the answer yes was recorded. and I'd like to restructure data so it looks like the following: id age gender Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 a 15 F 1 0 0 0 1 0 0 1 0 0 b 25 m 0 1 0 1 1 0 1 1 1 0 I know it's a cases to vars, but I have difficulty figuring out exactly how to do it. I'd appreciate your help. Thank you. Joanne ====================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 All,
I am working with SPSS 16.0 and I have a file that needs to be saved as a fixed ASCII. There is a numeric variable in the file that I have set to Width:1 and Decimals:0 however when I Save as a fixed ASCII the output looks like this... Variable Rec Start End Format d110 1 99 106 F8.2 Why is it changing it to a 8.2 format instead of 1? Any help would be appreciated. Thanks. Phebe ===================== 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 your using File>Save As and choosing fixed ASCII, paste your syntax and
then edit it to explicitly change the format. If your saving it some other way, tell us how you're doing that. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lacay, Phebe Sent: Wednesday, February 06, 2008 7:20 AM To: [hidden email] Subject: changing format length Hi All, I am working with SPSS 16.0 and I have a file that needs to be saved as a fixed ASCII. There is a numeric variable in the file that I have set to Width:1 and Decimals:0 however when I Save as a fixed ASCII the output looks like this... Variable Rec Start End Format d110 1 99 106 F8.2 Why is it changing it to a 8.2 format instead of 1? Any help would be appreciated. Thanks. Phebe ===================== 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 Joanne Tsai
The simple answer is basically
*** Get cases in the right order. Sort cases by id question. *** set the format of your question variable to have no decimal points so it can be used as the index. FORMAT question (f2.0). *** run casetovars (you can add other options if needed). CASESTOVARS /ID = Id /INDEX = question /GROUPBY = INDEX . You then need to check to be sure that all questions are included (i.e. SOMEONE answered yes) and you'll need to set the zero values. Recode q1 to q10 (sysmis=0). Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joanne Tsai Sent: Wednesday, February 06, 2008 8:03 AM To: [hidden email] Subject: [SPSSX-L] restructure question Dear colisters: I believe this is a fairly easy question, and I believe I have done this before, but I find myself stuck with this and can't get this done. I have a dataset looks similar like this Id age gender question answer a 15.00 F 1.00 1.00 a 15.00 F 5.00 1.00 a 15.00 F 8.00 1.00 a 15.00 F 10.00 1.00 b 25.00 m 2.00 1.00 b 25.00 m 4.00 1.00 b 25.00 m 5.00 1.00 b 25.00 m 7.00 1.00 b 25.00 m 8.00 1.00 b 25.00 m 9.00 1.00 there are 10 questions in tatal, and only the answer yes was recorded. and I'd like to restructure data so it looks like the following: id age gender Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 a 15 F 1 0 0 0 1 0 0 1 0 0 b 25 m 0 1 0 1 1 0 1 1 1 0 I know it's a cases to vars, but I have difficulty figuring out exactly how to do it. I'd appreciate your help. Thank you. Joanne ======= 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 |
|
In reply to this post by Joanne Tsai
The code wouldn't work b/c all my Answers are 1. I randomized the number
for Answer, and it worked as I expected. I don't know what's the reason behind it. This is what I got with all the answeres "1". Id age gender answer a 15.00 F 1.00 b 25.00 m 1.00 thank you. -----Original Message----- From: Melissa Ives [mailto:[hidden email]] Sent: Wednesday, February 06, 2008 10:07 AM To: Joanne Tsai; [hidden email] Subject: RE: [SPSSX-L] restructure question The simple answer is basically *** Get cases in the right order. Sort cases by id question. *** set the format of your question variable to have no decimal points so it can be used as the index. FORMAT question (f2.0). *** run casetovars (you can add other options if needed). CASESTOVARS /ID = Id /INDEX = question /GROUPBY = INDEX . You then need to check to be sure that all questions are included (i.e. SOMEONE answered yes) and you'll need to set the zero values. Recode q1 to q10 (sysmis=0). Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joanne Tsai Sent: Wednesday, February 06, 2008 8:03 AM To: [hidden email] Subject: [SPSSX-L] restructure question Dear colisters: I believe this is a fairly easy question, and I believe I have done this before, but I find myself stuck with this and can't get this done. I have a dataset looks similar like this Id age gender question answer a 15.00 F 1.00 1.00 a 15.00 F 5.00 1.00 a 15.00 F 8.00 1.00 a 15.00 F 10.00 1.00 b 25.00 m 2.00 1.00 b 25.00 m 4.00 1.00 b 25.00 m 5.00 1.00 b 25.00 m 7.00 1.00 b 25.00 m 8.00 1.00 b 25.00 m 9.00 1.00 there are 10 questions in tatal, and only the answer yes was recorded. and I'd like to restructure data so it looks like the following: id age gender Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 a 15 F 1 0 0 0 1 0 0 1 0 0 b 25 m 0 1 0 1 1 0 1 1 1 0 I know it's a cases to vars, but I have difficulty figuring out exactly how to do it. I'd appreciate your help. Thank you. Joanne ======= 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 |
|
Joanne,
Have all your respondents been administered all 10 items so that there are 10 occurrences of each ID? Brian -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joanne Tsai Sent: Wednesday, February 06, 2008 10:36 AM To: [hidden email] Subject: Re: restructure question The code wouldn't work b/c all my Answers are 1. I randomized the number for Answer, and it worked as I expected. I don't know what's the reason behind it. This is what I got with all the answeres "1". Id age gender answer a 15.00 F 1.00 b 25.00 m 1.00 thank you. -----Original Message----- From: Melissa Ives [mailto:[hidden email]] Sent: Wednesday, February 06, 2008 10:07 AM To: Joanne Tsai; [hidden email] Subject: RE: [SPSSX-L] restructure question The simple answer is basically *** Get cases in the right order. Sort cases by id question. *** set the format of your question variable to have no decimal points so it can be used as the index. FORMAT question (f2.0). *** run casetovars (you can add other options if needed). CASESTOVARS /ID = Id /INDEX = question /GROUPBY = INDEX . You then need to check to be sure that all questions are included (i.e. SOMEONE answered yes) and you'll need to set the zero values. Recode q1 to q10 (sysmis=0). Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joanne Tsai Sent: Wednesday, February 06, 2008 8:03 AM To: [hidden email] Subject: [SPSSX-L] restructure question Dear colisters: I believe this is a fairly easy question, and I believe I have done this before, but I find myself stuck with this and can't get this done. I have a dataset looks similar like this Id age gender question answer a 15.00 F 1.00 1.00 a 15.00 F 5.00 1.00 a 15.00 F 8.00 1.00 a 15.00 F 10.00 1.00 b 25.00 m 2.00 1.00 b 25.00 m 4.00 1.00 b 25.00 m 5.00 1.00 b 25.00 m 7.00 1.00 b 25.00 m 8.00 1.00 b 25.00 m 9.00 1.00 there are 10 questions in tatal, and only the answer yes was recorded. and I'd like to restructure data so it looks like the following: id age gender Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 a 15 F 1 0 0 0 1 0 0 1 0 0 b 25 m 0 1 0 1 1 0 1 1 1 0 I know it's a cases to vars, but I have difficulty figuring out exactly how to do it. I'd appreciate your help. Thank you. Joanne ======= 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 ===================== 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 Joanne Tsai
Tested now... Using the wizard.
The /VIND ROOT tells it to create new Q1-Q10 variables. Use the /COUNT subcommand if you want to know how many Yes answers there are. Using these data, there are no variables for Q3 or Q6. FORMAT question (f2.0). SORT CASES BY ID question . CASESTOVARS /ID = ID /INDEX = question /GROUPBY = INDEX /COUNT = Nquest "number of questions answered 'yes'" /VIND ROOT = Q. Melissa -----Original Message----- From: Joanne Tsai [mailto:[hidden email]] Sent: Wednesday, February 06, 2008 9:36 AM To: Melissa Ives; [hidden email] Subject: RE: [SPSSX-L] restructure question The code wouldn't work b/c all my Answers are 1. I randomized the number for Answer, and it worked as I expected. I don't know what's the reason behind it. This is what I got with all the answeres "1". Id age gender answer a 15.00 F 1.00 b 25.00 m 1.00 thank you. -----Original Message----- From: Melissa Ives [mailto:[hidden email]] Sent: Wednesday, February 06, 2008 10:07 AM To: Joanne Tsai; [hidden email] Subject: RE: [SPSSX-L] restructure question The simple answer is basically *** Get cases in the right order. Sort cases by id question. *** set the format of your question variable to have no decimal points so it can be used as the index. FORMAT question (f2.0). *** run casetovars (you can add other options if needed). CASESTOVARS /ID = Id /INDEX = question /GROUPBY = INDEX . You then need to check to be sure that all questions are included (i.e. SOMEONE answered yes) and you'll need to set the zero values. Recode q1 to q10 (sysmis=0). Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joanne Tsai Sent: Wednesday, February 06, 2008 8:03 AM To: [hidden email] Subject: [SPSSX-L] restructure question Dear colisters: I believe this is a fairly easy question, and I believe I have done this before, but I find myself stuck with this and can't get this done. I have a dataset looks similar like this Id age gender question answer a 15.00 F 1.00 1.00 a 15.00 F 5.00 1.00 a 15.00 F 8.00 1.00 a 15.00 F 10.00 1.00 b 25.00 m 2.00 1.00 b 25.00 m 4.00 1.00 b 25.00 m 5.00 1.00 b 25.00 m 7.00 1.00 b 25.00 m 8.00 1.00 b 25.00 m 9.00 1.00 there are 10 questions in tatal, and only the answer yes was recorded. and I'd like to restructure data so it looks like the following: id age gender Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 a 15 F 1 0 0 0 1 0 0 1 0 0 b 25 m 0 1 0 1 1 0 1 1 1 0 I know it's a cases to vars, but I have difficulty figuring out exactly how to do it. I'd appreciate your help. Thank you. Joanne ======= 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 |
|
In reply to this post by ViAnn Beadle
I am using File> Save As fixed ASCII, however when I paste syntax it
just gives me this: WRITE OUTFILE='C:\Documents and Settings\Desktop\filename.dat' TABLE /ALL. EXECUTE. How can I edit it further? -----Original Message----- From: ViAnn Beadle [mailto:[hidden email]] Sent: Wednesday, February 06, 2008 9:51 AM To: Lacay, Phebe Cc: [hidden email] Subject: RE: changing format length If your using File>Save As and choosing fixed ASCII, paste your syntax and then edit it to explicitly change the format. If your saving it some other way, tell us how you're doing that. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lacay, Phebe Sent: Wednesday, February 06, 2008 7:20 AM To: [hidden email] Subject: changing format length Hi All, I am working with SPSS 16.0 and I have a file that needs to be saved as a fixed ASCII. There is a numeric variable in the file that I have set to Width:1 and Decimals:0 however when I Save as a fixed ASCII the output looks like this... Variable Rec Start End Format d110 1 99 106 F8.2 Why is it changing it to a 8.2 format instead of 1? Any help would be appreciated. Thanks. Phebe ===================== 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 |
|
Go to the syntax window, put the cursor anywhere on the line and hit f1.
This will take you the syntax help for the WRITE command. You'll have to name your variables and use the format specifications for them (e.g, varname(F1.0). -----Original Message----- From: Lacay, Phebe [mailto:[hidden email]] Sent: Thursday, February 07, 2008 6:29 AM To: ViAnn Beadle Cc: [hidden email] Subject: RE: changing format length I am using File> Save As fixed ASCII, however when I paste syntax it just gives me this: WRITE OUTFILE='C:\Documents and Settings\Desktop\filename.dat' TABLE /ALL. EXECUTE. How can I edit it further? -----Original Message----- From: ViAnn Beadle [mailto:[hidden email]] Sent: Wednesday, February 06, 2008 9:51 AM To: Lacay, Phebe Cc: [hidden email] Subject: RE: changing format length If your using File>Save As and choosing fixed ASCII, paste your syntax and then edit it to explicitly change the format. If your saving it some other way, tell us how you're doing that. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lacay, Phebe Sent: Wednesday, February 06, 2008 7:20 AM To: [hidden email] Subject: changing format length Hi All, I am working with SPSS 16.0 and I have a file that needs to be saved as a fixed ASCII. There is a numeric variable in the file that I have set to Width:1 and Decimals:0 however when I Save as a fixed ASCII the output looks like this... Variable Rec Start End Format d110 1 99 106 F8.2 Why is it changing it to a 8.2 format instead of 1? Any help would be appreciated. Thanks. Phebe ===================== 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 Lacay, Phebe
You can specify formats on the WRITE command, or you can specify formats prior to the WRITE command. If you're only concerned with one variable (d110), the simplest solution might be:
formats d110 (f1.0). write outfile=... -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lacay, Phebe Sent: Thursday, February 07, 2008 7:29 AM To: [hidden email] Subject: Re: changing format length I am using File> Save As fixed ASCII, however when I paste syntax it just gives me this: WRITE OUTFILE='C:\Documents and Settings\Desktop\filename.dat' TABLE /ALL. EXECUTE. How can I edit it further? -----Original Message----- From: ViAnn Beadle [mailto:[hidden email]] Sent: Wednesday, February 06, 2008 9:51 AM To: Lacay, Phebe Cc: [hidden email] Subject: RE: changing format length If your using File>Save As and choosing fixed ASCII, paste your syntax and then edit it to explicitly change the format. If your saving it some other way, tell us how you're doing that. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lacay, Phebe Sent: Wednesday, February 06, 2008 7:20 AM To: [hidden email] Subject: changing format length Hi All, I am working with SPSS 16.0 and I have a file that needs to be saved as a fixed ASCII. There is a numeric variable in the file that I have set to Width:1 and Decimals:0 however when I Save as a fixed ASCII the output looks like this... Variable Rec Start End Format d110 1 99 106 F8.2 Why is it changing it to a 8.2 format instead of 1? Any help would be appreciated. Thanks. Phebe ===================== 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 |
| Free forum by Nabble | Edit this page |
