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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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