0
votes

I have a problem with changing value labels of xaxis in proc sgplot (see graph). I want to change x value labels 0 to 'female' and 1 to 'male', what should I do?
Many thanks in advance!

this is a box plot, label of x is gender, and I want the value labels displaying female instead of "0" and male instead of '1'

1

1 Answers

0
votes

You should change the value before creating your GPLOT. Following this example : http://documentation.sas.com/?docsetId=graphref&docsetTarget=n0zqluxg8kkrign1t1t727dis8ea.htm&docsetVersion=9.4&locale=en

First prepare your data :

data work.classtemp (drop=name );
   length Gender $ 6;
   set sashelp.class;
   if sex="F" then Gender="Female";
      else Gender="Male";
run;
proc sort data=work.classtemp out=work.class;
   by weight height;
run;

After, label defintion :

legend1 label=none value=("Male" "Female") Position=(right middle outside)
across=1;
legend2 label=none value=("Male" "Female"); 

In your case you have to prepare your data before the GPLOT by changing the 1 to Male and 0 to Female.

With something like this :

data want;
set mydata;
if value=0 then Gender="Female";
else Gender="Male";
run;

Regards