|
Hello All,
I am working on a study where each person is measured several times over the course of six months. There are some cases where missing data exists but it should not be a problem for my first steps of this analysis. This is the problem: I have been trying to develop a code to double check some work that was done by hand. Since there is greater room for error when changes are made by hand, I thought that it would be more effective to figure out some code in SPSS. For some reason, my current code seems to be having some problems. Here is an example of the data that I have: Patient Wound Meds 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 2 1 1 2 1 0 2 0 1 3 1 0 3 1 0 3 1 0 3 1 0 In the dataset above, 0 represents "no" and 1 represents "yes". I want to create new columns where I have the following: Patient Ever_Wound Ever_used_Meds 1 0 1 2 1 1 3 1 0 In other words, I want to create a new dataset where I have only one measurement per patient and I have data on whether or not the patient experienced any of the conditions. So, I want to say something like this: if sum of the wounds for a single patient = 0, then ever_wound = 0. If sum of the wounds for a single patient >= 0, then ever_wound = 1. I want to be able to do the above for each variable and each patient. Is there a specific marco that someone can help me out with to reach my outcome? If you need to see my code thus far, please let me know. Any assistance that you can offer in this matter would be greatly appreciated. Thank you very much in advance. Johnita ====================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 Johnita
* your data *. DATA LIST LIST/Patient Wound Meds (3 F8). BEGIN DATA 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 2 1 1 2 1 0 2 0 1 3 1 0 3 1 0 3 1 0 3 1 0 END DATA. * the new dataset *. DATASET DECLARE Aggregated. AGGREGATE /OUTFILE='Aggregated' /BREAK=Patient /Ever_Wound= MAX(Wound) /Ever_Used_Meds= MAX(Meds). DATASET ACTIVATE Aggregated. LIST. Best regards, Marta > I am working on a study where each person is measured several times over > the course of six months. There are some cases where missing data > exists but it should not be a problem for my first steps of this > analysis. This is the problem: I have been trying to develop a code to > double check some work that was done by hand. Since there is greater > room for error when changes are made by hand, I thought that it would be > more effective to figure out some code in SPSS. For some reason, my > current code seems to be having some problems. Here is an example of > the data that I have: > > > > Patient Wound Meds > > 1 0 0 > > 1 0 0 > > 1 0 1 > > 1 0 1 > > 1 0 0 > > 2 1 1 > > 2 1 0 > > 2 0 1 > > 3 1 0 > > 3 1 0 > > 3 1 0 > > 3 1 0 > > > > In the dataset above, 0 represents "no" and 1 represents "yes". I want > to create new columns where I have the following: > > > > Patient Ever_Wound Ever_used_Meds > > 1 0 1 > > 2 1 1 > > 3 1 0 > > > > In other words, I want to create a new dataset where I have only one > measurement per patient and I have data on whether or not the patient > experienced any of the conditions. So, I want to say something like > this: if sum of the wounds for a single patient = 0, then > ever_wound = 0. > > > If sum of the wounds for a single patient >= 0, then ever_wound = 1. > > > > I want to be able to do the above for each variable and each patient. > Is there a specific marco that someone can help me out with to reach my > outcome? If you need to see my code thus far, please let me know. Any > assistance that you can offer in this matter would be greatly > appreciated. Thank you very much in advance. > > > > Johnita > > =================== > 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 |
