* How can I compare (superimpose) 2 histogram. ******************************. * First method. ******************************. * Answer posted to newsgroup by Raynald Levesque on 2003/02/13. GET FILE='c:\\program files\\spss\\employee data.sav'. COMPUTE beg=TRUNC(salbegin/5000). COMPUTE sal=TRUNC(salary/5000). SORT CASES BY beg. AGGREGATE OUTFILE='c:\\temp\\beg.sav' /PRESORTED /BREAK=beg /nbeg=n. SORT CASES BY sal. AGGREGATE OUTFILE=* /PRESORTED /BREAK=sal /nsal=n. MATCH FILES FILE=* /RENAME=(sal=beg) /FILE='c:\\temp\\beg.sav' /BY=beg. GRAPH /LINE(MULTIPLE)= VALUE( nbeg nsal ) BY beg . ******************************. * Second Method. ******************************. Date: Fri, 23 Jun 2000 20:38:37 -0400 Sender: "SPSSX(r) Discussion" From: Raynald Levesque Subject: Re: superimpsed histograms Hi Arthur! This is a possible solution: *Define dummy data file for illustration purposes. NEW file. SET SEED=975316421. INPUT PROGRAM. - LOOP id=1 TO 50. - COMPUTE income=RV.NORMAL(35,5). - COMPUTE group=UNIFORM(1)>.5. - END CASE. - END LOOP. - END FILE. END INPUT PROGRAM. EXECUTE. SAVE OUTFILE='temp.sav'. GRAPH /HISTOGRAM=income . * look at the histogram and note the smallest value and the range of each bin. * in this case the smallest mid point of a bin is 18,000 and the range is 2000. * Recode the income values as follows. LOOP cnt=18 TO 46 BY 2. - IF RANGE(income,cnt-1,cnt+0.99999) income1=cnt. END LOOP. EXECUTE. GRAPH /BAR(GROUPED)=COUNT BY income1 BY group /MISSING=REPORT.