1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
* Show Two Categories on same histogram.
* Define dummy data file for illustration purposes.
* rlevesque@videotron.ca.

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.

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.
* (Of course the above 2 lines could be automated if necessary).

* Recode the income values as folows.
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.