* QUESTION: Data contains school number, school name and scores. How can I print school name at the top of graphs and tables. * ANSWER by rlevesque@videotron.ca. DATA LIST FREE /school (F8.0) s_name(A12) score (F8.0). BEGIN DATA 1 's_one' 19 1 's_one' 14 1 's_one' 29 1 's_one' 20 2 's_two' 13 2 's_two' 24 2 's_two' 24 2 's_two' 22 3 's_three' 20 3 's_three' 34 3 's_three' 27 3 's_three' 25 7 's_seven' 40 7 's_seven' 44 7 's_seven' 22 7 's_seven' 26 END DATA. SORT CASES BY school. SAVE OUTFILE='c:\\temp\\temp.sav'. * Count number of schools. AGGREGATE /OUTFILE=* /BREAK=school /s_name = FIRST(s_name). RANK VARIABLES=school (A) /RANK /N INTO n_school. * Define a macro which contains the number of schools. DO IF \$casenum=1. WRITE OUTFILE 'c:\\temp\\temp.sps' /"DEFINE !n_sch()"/n_school/"!ENDDEFINE.". END IF. EXECUTE. INCLUDE FILE='c:\\temp\\temp.sps'. * Define a macro which contains the schools names. STRING str_nam(A8). COMPUTE str_nam=CONCAT('!nam',LTRIM(STRING(rschool,F8.0)," "),"()"). DO REPEAT r=1 TO !n_sch. + DO IF rschool=r. + WRITE OUTFILE 'c:\\temp\\temp.sps' /"DEFINE "str_nam /s_name/"!ENDDEFINE.". + END IF. END REPEAT. EXECUTE. INCLUDE 'c:\\temp\\temp.sps'. MATCH FILES /TABLE=* /FILE='C:\\temp\\temp.sav' /BY school. *Define a macro to do the job. *////////////////////////////////////. DEFINE !doit(). !DO !sch=1 !TO !EVAL(!n_sch). COMPUTE filter_=(rschool=!sch). FILTER BY filter_. * Reader: replace next 2 titles, graph and Summarize commands by what is needed. !LET !title1=!QUOTE(!EVAL(!CONCAT('Histogram for ','!nam',!sch))) !LET !title2=!QUOTE(!EVAL(!CONCAT('Case summaries for ','!nam',!sch))) GRAPH /TITLE=!title1 /HISTOGRAM=score . SUMMARIZE /TABLES=score /FORMAT=NOLIST TOTAL /TITLE=!title2 /MISSING=VARIABLE /CELLS=COUNT MEDIAN VAR . FILTER OFF. !DOEND !ENDDEFINE. *////////////////////////////////////. *Call macro. !doit.