* convert a file from univariate to multivariate format * The first example has an index number already in the data (charct). DATA LIST free / student score charct. BEGIN DATA 1 10 4 1 20 3 1 30 2 1 40 1 2 15 2 2 25 1 4 25 2 4 55 4 3 40 1 3 55 2 3 60 3 END DATA. LIST. * set the dimensions of the vector result to the largest number. * of records for a student (in the data above student=1 has 4). VECTOR result(4). COMPUTE result(charct)=score. SORT CASES BY student charct. LIST. AGGREGATE outfile=* / BREAK=student / result1 to result4=max(result1 to result4). PRINT FORMATS student (F3.0) result1 to result4 (F4.1). PRINT / student result1 to result4. EXECUTE. AGGREGATE outfile =* / break = student / r1 to r4 = first(result1 to result4). EXECUTE. * in this example, only the data are given * the program computes the index number in the order data appear (charct). DATA LIST free / student score. BEGIN DATA 1 25 1 30 1 32 2 27 2 35 2 37 3 21 3 23 3 33 4 15 4 22 4 29 5 30 5 31 5 35 6 19 6 27 6 28 END DATA.       LIST. EXECUTE. * set the dimensions of the vector result to the largest number. * of records for a student (in the data above student=1 has 4). COMPUTE charct=1. DO IF ($CASENUM NE 1). *This is to ensure a valid value for tasknum in case #1; *since there is no lagged case for it, it would return *a missing value otherwise IF (student EQ LAG(student)) charct = LAG(charct)+1. END IF. LIST. VECTOR result(3). COMPUTE result(charct)=score. SORT CASES BY student . LIST. AGGREGATE outfile=* / BREAK=student / result1 to result3=max(result1 to result3). PRINT FORMATS student (F3.0) result1 to result3 (F4.0). PRINT / student result1 to result3. EXECUTE. AGGREGATE outfile =* / break = student / r1 to r3 = first(result1 to result3). EXECUTE. * spss: multivariate to univariate * I have received data as follows: * Subject sup4 notsup4 ambig4 sup2 notsup2 ambig2 * 1 0 0 4 2 0 0 * 2 0 1 3 1 1 0 * 3 1 1 2 2 0 0 * The numbers following the ascription in the variable name are the * number of scenarios presented.... ..subject #1 receives four * descriptions of a scenario, of which they rate each description as * either being supporting, not supporting, or ambiguous; this is a completely * within-subject design, so in this sample of data, subject #1 was * presented with four situations and rated four as being ambiguous; * subsequently they are given two situations (related to the same * scenario) and rate them again (in this instance s#1 rates them both as * being supportive); the above datapoints are for one scenario, so they * actually had 4 scenarios each........we were * interested at looking at the type of scenario x rating interaction *(e.g., 4 x 3 chi-square), however, beyond the experimental logistics that may * advise against this type of analysis (i.e., nonindependence of data), * this analysis was mainly a check after the fact to see if any * descriptions are particularly problematic (i.e., ambiguous); well, * unfortunately the data came to me in the above fashion meaning it was aggregated with each cell representing a sum (e.g., subject #3 said two descriptions were ambiguous for the '4' condition [ambig4]), instead of being true count data; I know how to use syntax to convert multiple records into one (e.g., vector outside a loop structure), but I am having troubles using some type of 'repeating data' command to create multiple records for each subject, and be able to convert the massed count for each cell into a RATING type variable, as described below......so, ideally my data should look like the following (for one subject and two contiguous scenarios): > RATING > Support=1 > Not support=2 > Ambiguous=3 > > SCENARIO > 4 descriptions=1 > 2 descriptions=2 > > Subject Rating Scenario > 1 3 1 > 1 3 1 > 1 3 1 > 1 3 1 > 1 1 2 > 1 1 2 > Are there any aggregate or looped commands that may remediate my perpelexity? Using the variable names given in your example, the following syntax does the job: VECTOR v_rate(6) v_scen(6)v_data=sup4 TO ambig2. COMPUTE #done=0. LOOP #A=1 TO 6. DO IF v_data(#A)>0. LOOP #B=1 TO v_data(#A). COMPUTE v_rate(#done+#B)=#A - 3*(#A>3). END LOOP. COMPUTE #done=#done + v_data(#A). END IF. END LOOP. * now transform data from 1 record per subject to 6 records per subject. LOOP #cnt=1 TO 6. COMPUTE rating=v_rate(#cnt). COMPUTE scenario=1+(#cnt>4). XSAVE OUTFILE='temp.sav' /KEEP subject rating scenario. END LOOP. EXECUTE. GET FILE='temp.sav'. FORMATS subject TO scenario(F8.0). EXECUTE. * Raynald Levesque