Help using Base SAS procedures

PROC GPLOT, BLOCK statement, Annotation Data Set

Reply
New Contributor
Posts: 2

PROC GPLOT, BLOCK statement, Annotation Data Set

I have created an 3D block chat using PROC GPLOT's BLOCK statement (code below).

I would like to show the number and percentage of occurrences in each cell as N (x.x%).  I have found ways to show either the total or the percentages, but not both at the same time.  (Actually I was able to do both with a format trick, but when the text string exceeded 8 characters it was truncated.)  Anyway, it seems the solution is an annotation dataset--So I created one.  Unfortunately, the block statement is completely ignoring it.  I hope someone can tell me what I need to do to make the block statement respect the anotation data set.

The example program below uses dataset SASHELP.CLASS.

Any help is appreciated.

goptions device=png;

data class;

   set sashelp.class;

   key=ranuni(0);

   if key>.7 then response='Yes';

   else           response='No';

run;

proc freq data=work.class noprint;

    tables sex*age*response/list missing out=freqout;

run;

data freqout;

    set freqout;

    agec=put(age,2.);

run;

data annotate;

   length color style $ 8 text $20;

   retain color "white" when "a" style "arial"

      xsys ysys "2" position "5" size 4 hsys "3";

   set freqout;

   midpoint=agec;

   group=sex;

   subgroup=response;

   text=strip(put(count,6.))|| ' ' || '(' || strip(put((percent/100),percent6.1)) || ')' ;

run;

goptions colors=(/*tomato,*/ orange, vligb, purple);

PROC GCHART DATA=WORK.freqout  ;

     BLOCK agec / CAXES=black freq=count    noheading  ANNO=annotate

            SUBGROUP=response   

            GROUP=sex

            TYpe=freq  /* freq or percent to change what numbers are displayed */

      ; 

run ;    quit;

Ask a Question
Discussion stats
  • 0 replies
  • 144 views
  • 0 likes
  • 1 in conversation