BookmarkSubscribeRSS Feed
sgraham929
Calcite | Level 5

This is ridiculously simple... I am sorry for even having to ask it, but I am brand new to SAS and have been struggling with this problem for almost 6 hours!

I am trying to create a box plot for a class assignment...

Given the data set:

Cross    Self

23.500  17.375

12.000  20.375

21.000  20.000

22.000  20.000

19.125  18.375

21.550  18.625

22.125  18.625

20.375  15.250

18.250  16.500

21.625  18.000

23.250  16.250

21.000  18.000

22.125  12.750

23.000  15.500

12.000  18.000

I now need to create two box plots for the Cross column and Self column. So far, I have tried running the proc univariate, proc sort the data, and then proc boxplot. I did the univariate and proc sort for each column seperately. I need these two box plots to be side by side and vertical.

Any help is appreciated, I am at my wits end.

Thanks!

3 REPLIES 3
data_null__
Jade | Level 19

One way is to make a CATEGORY for CROSS and SELF.

data cross;
   do grp='Cross','Self';
     
input y @;
      output;
     
end;
  
cards;
23.500  17.375
12.000  20.375
21.000  20.000
22.000  20.000
19.125  18.375
21.550  18.625
22.125  18.625
20.375  15.250
18.250  16.500
21.625  18.000
23.250  16.250
21.000  18.000
22.125  12.750
23.000  15.500
12.000  18.000
;;;;
   run;
proc sort data=cross;
   by grp;
   run;
proc sgplot;
  
vbox y / category=grp;
   run;
  
quit;
sgraham929
Calcite | Level 5

I tried putting this code in verbatim, but was still not able to get the box plots... I am at a complete loss here. After messing with the code for a while I really don't know what else to try. There weren't any Error messages in the log... just not output either. If I am doing something really stupid, please let me know. This is / was my first solo attempt at SAS and I have never used any other computer languages prior to this.

Thank you for your time on this. It's very appreciated.

Tom
Super User Tom
Super User

You need to tell the statistical graphics procs where to make the graph.  Turn on an ODS destination.

ODS HTML ;

proc sg....

...

ODS HTML CLOSE;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 455 views
  • 0 likes
  • 3 in conversation