BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

Hi Guys,

 

This histogram is not going my way. I'd like to achieve:

- present the all rows taller so Y-axis would show 0 through 100 by increasing the vertical dimension of the whole plot. 

- customize and label GROUPS so it will appear as "benign" instead group=6 and "malignant" instead group=5 so forth so on for all groups. 

 

You help will be greatly appreciated. 

Thanks in advance. 

 

proc univariate data=HAVE noprint;
   class GROUP;
   histogram VALUES/ nrows = 6
                     vaxis      =   0  to 100  by  1;
   inset median mean std / pos = ne format = 6.3;
run;

data Have;
do GROUP = 1 to 6;
   do j = 1 to 50;
      VALUES = rand("Normal", Group);
      output;
   end;
end;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Use the ODS GRAPHICS statement to set the vertical size of the plot.

Use PROC FORMAT to define the categories that you want to use for the GROUP=1 to 6 values:

 

data Have;
do GROUP = 1 to 6;
   do j = 1 to 50;
      VALUES = rand("Normal", Group);
      output;
   end;
end;
run;

proc format;
value TumorFmt  
      1 = "Benign"
      2 = "Cat 2"
      3 = "Next Value"
      4 = "Another"
      5 = "Almost There"
      6 = "Malignant";
run;

ods graphics / height=1000px width=400px;
proc univariate data=HAVE noprint;
   format GROUP TumorFmt.;
   class GROUP;
   histogram VALUES/ nrows = 6
                     vaxis      =   0  to 100  by  10;
   inset median mean std / pos = ne format = 6.3;
run;

View solution in original post

1 REPLY 1
Rick_SAS
SAS Super FREQ

Use the ODS GRAPHICS statement to set the vertical size of the plot.

Use PROC FORMAT to define the categories that you want to use for the GROUP=1 to 6 values:

 

data Have;
do GROUP = 1 to 6;
   do j = 1 to 50;
      VALUES = rand("Normal", Group);
      output;
   end;
end;
run;

proc format;
value TumorFmt  
      1 = "Benign"
      2 = "Cat 2"
      3 = "Next Value"
      4 = "Another"
      5 = "Almost There"
      6 = "Malignant";
run;

ods graphics / height=1000px width=400px;
proc univariate data=HAVE noprint;
   format GROUP TumorFmt.;
   class GROUP;
   histogram VALUES/ nrows = 6
                     vaxis      =   0  to 100  by  10;
   inset median mean std / pos = ne format = 6.3;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 2564 views
  • 3 likes
  • 2 in conversation