|
At 07:25 AM 4/10/2010, Jeanie Li wrote:
I am stuck on one issue related to matching cases across different files. I collaborate with a professor in another university to administer an online questionnaire to her students. The questionnaire has 20 subscales. One semester, instead of subjects logging with one ID to fill out the 20 subscales, they logged in multiple times with different IDs to complete different portions of the questionnaire. [Their records] are also labeled with their student ID. With the student ID in the records, this doesn't sound too bad. It looks like you have a separate file for each scale: Scale 1 First, now, before you do anything else, add a variable to every record that identifies which scale it's for: Scale 1 Scale ID student ID item 1 item 2 item 3 item 4 item 5 1 1 1 3 2 2 2 3 1 2 1 3 2 3 2 3 Scale 2 Scale ID student ID item 1 item 2 item 3 item 4 item 5 2 2 1 1 1 1 1 1 The following should work for files with data for only one scale, or for a file with all data together. As written, it assumes the response variables are numeric. It creates one record per scale per student, with responses recorded for every item the student has ever responded to. If the student's responded more than once to any item, it keeps the response from the highest-numbered ID, which I suppose is the latest; that can be changed, if desired. To keep a record where of where the results came from, the file also contains * The number of records for that scale for that student * The lowest and highest IDs for that scale for that student This code is not tested. * Make sure the raw data dataset is named, so it won't be . * lost if you use another dataset. Skip this step, if the . * data is already in a named dataset which is the active . * dataset. . DATASET NAME RawData WINDOW=FRONT. * SORT CASES is rarely necessary for AGGREGATE. Here it is, . * so the LAST function will get the value from the highest- . * numbered ID. . SORT CASES BY Scale student_ID ID. * Create the summary, with one record per scale per student, . * in a separate dataset . DATASET DECLARE Summary WINDOW=HIDDEN. AGGREGATE OUTFILE=Summary /BREAK=Scale Scale student_ID /NRecs 'Number of records summarized' = NU /MinID 'Lowest ID, for this student and scale' = MIN(ID) /MaxID 'Highest ID, for this student and scale' = MAX(ID) / item_1 TO item_6 /* This only works with variable names */ = LAST(item_1 TO item_6) /* in form 'name'+'numeric suffix'. */. * Make the summary dataset active, for further processing . DATASET ACTIVATE Summary WINDOW=FRONT. ===================== 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 |
