*(Q) How can I produce the following table. Simple Table Design... PRODUCT V.Poor Poor Neutral Good Exc. Mean N Product A 17% 8% 33% 17% 25% 3.25 12 Product B 17% 8% 33% 17% 25% 3.25 12 Product C 17% 8% 33% 8% 33% 3.33 12 Product D 42% 8% 8% 8% 33% 2.83 12 Product E 17% 42% 8% 8% 25% 2.83 12 Product F 17% 17% 33% 8% 25% 3.08 12 Product G 42% 8% 17% 8% 25% 2.67 12 Product H 17% 0% 17% 42% 25% 3.58 12 *(A) Posted to SPSSX-L by Raynald Levesque on 2002/09/21. * Visit http://pages.infinit.net/rlevesqu/index.htm * The solutions below assume that there are less than approx 32,700 cases (The flipped file can have a maximum of 32,768 variables). If this limitation is a problem let me know and I will look for a workaround. ***********************. * First method assumes we know the number of cases. ***********************. DATA LIST LIST /ProdA ProdB ProdC ProdD ProdE ProdF ProdG ProdH. BEGIN DATA 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 1 1 1 1 2 2 3 3 4 4 4 4 1 1 1 1 5 5 5 5 2 2 2 4 4 4 5 5 5 5 5 5 3 3 3 1 2 3 1 4 3 3 3 1 2 3 1 4 3 3 3 1 2 3 1 4 END DATA. FLIP. VECTOR v=var001 TO var010. DO REPEAT cnt=1 TO 5 /c=c1 TO c5. . COUNT c=var001 TO var010 (cnt). . COMPUTE meanval=MEAN(var001 TO var010). . COMPUTE n=NVALID(var001 TO var010). . COMPUTE c=c/n*100. . FORMATS c(PCT4.0). END REPEAT PRINT. STRING product(A14). COMPUTE product = CONCAT("Product ",SUBSTR(case_lbl,5,1)). FORMATS n(COMMA8). VARIABLE LABEL meanval "Mean" c1 "Very Poor" /c2 "Poor" /c3 "Neutral" /c4 "Good" /c5 "Excellent". SUMMARIZE /TABLES=product c1 c2 c3 c4 c5 meanval n /FORMAT=VALIDLIST NOCASENUM TOTAL /TITLE='Simple Table Design...' /MISSING=VARIABLE /CELLS=NONE. EXECUTE. ***********************. * Second method is completely general. The code determines the number * of cases and adjust the syntax accordingly. ***********************. DATA LIST LIST /ProdA ProdB ProdC ProdD ProdE ProdF ProdG ProdH. BEGIN DATA 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 1 1 1 1 2 2 3 3 4 4 4 4 1 1 1 1 5 5 5 5 2 2 2 4 4 4 5 5 5 5 5 5 3 3 3 1 2 3 1 4 3 3 3 1 2 3 1 4 3 3 3 1 2 3 1 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 END DATA. SAVE OUTFILE='c:\temp\original data.sav'. * Calculate # of cases. COMPUTE nobreak=1. RANK VARIABLES=proda BY nobreak /N INTO nbcases. DO IF \$CASENUM=1. WRITE OUTFILE='c:\temp\nbcases.sps' /"DEFINE !nb()"nbcases"!ENDDEFINE.". END IF. EXECUTE. INCLUDE 'c:\temp\nbcases.sps'. * Define the variable names after the FLIP. STRING v(A8). COMPUTE v=CONCAT("v",LTRIM(STRING(\$CASENUM,F7))). FLIP VARIABLES=proda TO prodh /NEWNAME=v . *////////////////////. DEFINE !doit(). !LET !vlast=!CONCAT(v,!nb) VECTOR v=v1 TO !vlast. DO REPEAT cnt=1 TO 5 /c=c1 TO c5. . COUNT c=v1 TO !vlast (cnt). . COMPUTE meanval=MEAN(v1 TO !vlast). . COMPUTE n=NVALID(v1 TO !vlast). . COMPUTE c=c/n*100. . FORMATS c(PCT4.0). END REPEAT PRINT. STRING product(A14). COMPUTE product = CONCAT("Product ",SUBSTR(case_lbl,5,1)). FORMATS n(COMMA8). VARIABLE LABEL meanval "Mean" c1 "Very Poor" /c2 "Poor" /c3 "Neutral" /c4 "Good" /c5 "Excellent". SUMMARIZE /TABLES=product c1 c2 c3 c4 c5 meanval n /FORMAT=VALIDLIST NOCASENUM TOTAL /TITLE='Simple Table Design...' /MISSING=VARIABLE /CELLS=NONE. !ENDDEFINE. *//// ///// //////. * Call macro to do it. SET MPRINT=yes. !doit. SET MPRINT=no.