*(Q) * stimcode (has 3 levels) respcode is supposed to have 4 levels (1 to 4) * for a total number of 12 combinations (cases). * However, some of the levels of respcode are missing. * The task is to fill the gaps. * For example when I have stimcode respcode rt N 128 1 128 2 128 3 128 4 129 1 129 2 129 3 129 4 130 2 130 3 130 4 *I want to add a case with 130 1 0 0 * (A) Posted to SPSSX-L list by rlevesque@videotron.ca on 2002/11/08. * The solution works for any 3 levels of stimcode but all 3 level must be present. * Create a data file for illustration purposes (note that 3 cases are missing). NEW FILE. DATA LIST LIST /stimcode respcode rt N. BEGIN DATA 128 1 128 2 128 3 128 4 129 3 129 4 130 2 130 3 130 4 END DATA. SAVE OUTFILE='c:\\temp\\data file.sav'. * find the 3 stimcode. SORT CASES BY stimcode. AGGREGATE OUTFILE=* /PRESORTED /BREAK=stimcode /tmp 'is not used'=n. COMPUTE rt=0. COMPUTE n=0. * create a file with the 12 potential "filldata" cases. LOOP respcode=1 TO 4. + XSAVE OUTFILE='c:\\temp\\temp.sav' /KEEP=stimcode respcode rt n. END LOOP. EXECUTE. * combine potential 'filldata" cases with the initial data file. ADD FILES FILE='c:\\temp\\temp.sav' /IN=filldata FILE='c:\\temp\\data file.sav'. SORT CASES BY stimcode respcode filldata. MATCH FILES FILE=* /BY stimcode respcode /FIRST=first. EXECUTE. * keep only "filldata" cases we need. SELECT IF first=1. * clean up. ADD FILES FILE=* /DROP=filldata first. EXECUTE.