cancel
Showing results for 
Search instead for 
Did you mean: 

Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

SOLVED
montgomerybarre
Obsidian | Level 7
Solved!

Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

Message contains an image

montgomerybarre_0-1702079519957.png

I haver never had this issue before, seems like no matter what I try, sgplot is forcing this diagonal line. I have tried sorting the data in different ways, using different yaxis, xaxis, and discreteorder options, the scatter, series, and other statements... etc. All producing the same problem.

 

proc sgplot data=final ;
scatter x=month_year y=rate / group=state;
yaxis type=discrete;
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Solution

Re: Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

Make sure your variable "rate " is NUMERIC tpye ,not CHARACTER.

View solution in original post

6 REPLIES 6
DanH_sas
SAS Super FREQ

Re: Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

Did you intentionally make the YAXIS to be discrete?

montgomerybarre
Obsidian | Level 7

Re: Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

I tried discrete, linear, etc.

ballardw
Super User

Re: Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

If you can't share an example of your actual data then show us the complete output for Proc Contents for the data set.

Ksharp
Super User
Solution

Re: Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

Make sure your variable "rate " is NUMERIC tpye ,not CHARACTER.
montgomerybarre
Obsidian | Level 7

Re: Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?

Yup, the variable was somehow read in as character. Dumb mistake, thanks all!

ballardw
Super User

Re: Every plot I make in proc SGPLOT forces a diagonal line via odd sorting of y axis?


@montgomerybarre wrote:

Yup, the variable was somehow read in as character. Dumb mistake, thanks all!


Proc import or other "import" widget perhaps? From spreadsheet? All it takes is a very common two or more header row for a column to make character values with Import.