options nodate pagesize=54 linesize=80; /* Read in the input file */ /* Then Give qualitative levels for foutcome */ data ex0105; * infile '../../../data/biostat/ex0105.dat'; infile 'C:\\biostat\\data\\ex0105.dat'; input outcome; length foutcome $10.; if outcome=1 then foutcome='Cure'; else if outcome=2 then foutcome='Part Cure'; else if outcome=3 then foutcome='Ab Ext'; else if outcome=4 then foutcome='Ab Chng'; else if outcome=5 then foutcome='Death'; run; /* Sort by outcome */ proc sort; by outcome; /* Get frequency distribution for foutcome */ proc freq order=data; tables foutcome; run; /* Obtain vertical barchart for foutcome. The midpoints option keeps it from putting categories in alphabetical order */ proc chart; vbar foutcome / midpoints='Cure' 'Part Cure' 'Ab Ext' 'Ab Chng' 'Death'; run; /* Obtain pie chart for outcome */ proc chart; pie foutcome / midpoints='Cure' 'Part Cure' 'Ab Ext' 'Ab Chng' 'Death'; run; quit;