Data visualization with SAS programming

SGPLOT compared with GCHART

Reply
Contributor
Posts: 42

SGPLOT compared with GCHART

This post should contain one format statement, one proc gchart and one question. If you are not seeing all of these, it means my question was truncated.
proc format;
value xxx
0 <- .10 = '0 to 10%'
.10 <- .30 = '10% to 30%'
.30 <- .60 = '30% to 60%'
.60 <- high = 'More than 60%';
run;
proc gchart data=inputdata;
format val xxx.;
vbar val / freq=_freq discrete;
run;
quit;

How can I create this same plot using PROC SGPLOT? I'm having trouble finding the options I need either in the XAXIS statement of SGPLOT or the options. I'm probably just missing something obvious that's already in the documentation, but can anybody help me make my plot?

The point of this for me is to learn SGPLOT, so please don't say "if you're already doing it, why worry".

Message was edited by: mftuchman

Message was edited by: mftuchman

Message was edited by: mftuchman
SAS Super FREQ
Posts: 925

Re: SGPLOT compared with GCHART

For this example, all you need to do is drop the word DISCRETE and change the proc name to SGPLOT :-)

Dan
Contributor
Posts: 42

Re: SGPLOT compared with GCHART

OK. That worked. Thank you. It just seems odd that I need to specify DISCRETE in one environment but not the other.

How does PROC SGPLOT "think", in this particular instance? Also, what's the sgplot analog for LEVELS=n?
SAS Super FREQ
Posts: 925

Re: SGPLOT compared with GCHART

Currently, there is not a direct analog to the LEVELS option. By default, the procedure summarizes on DISCRETE numeric or character values. To achieve the LEVELS functionality, you can define your own user-defined format to establish your ranges and define the label for each range.

Thanks!
Dan
Valued Guide
Posts: 632

Re: SGPLOT compared with GCHART

The following link talks about the markup text used in the forum and gives some direction as to why your post was truncated.
http://support.sas.com/forums/thread.jspa?messageID=27609毙
SAS Super FREQ
Posts: 1,139

Re: SGPLOT compared with GCHART

Posting a program with special characters like < or > or / causes problems to how the message shows up in the viewer. You can use the appropriate HTML escape characters for these special characters, as I have use here. The / (forward slash) for the statement options is really needed.

Here is a link to the full list of HTML escape characters:
http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php
Ask a Question
Discussion stats
  • 5 replies
  • 265 views
  • 1 like
  • 4 in conversation