I am a new user to SAS/GRAPH. I have a requirement where I need to plot variables X and variable Y. The values in variable X are something like 400, 92345, 96457, 97876, 99876, 100456 etc etc..... Now when I use the normal SAS code the horizontal x axis is drawn to scale i.e I get a huge space between the first datapoint and the 2nd datapoint and the remaining datapoints are very close to each other. I need the chart in such a way that only the values of the datapoints are plotted and all of them are equally spaced ( Just like how we get when using Excel spreadhseet). Any help will be greatly apperciated.
You could do something like creating an index variable that goes from 1 to n to replace x and then in an axis statement use the value= option to specify the major tick marks as the actual x-values. This is a bit tedious and involves a bit of hard coding but if the data set is relatively small and this is a one time graph it may be a good enough quick fix.
Annotated data sets would probably be better but I don't know much about how to use them.
Here's a slight variation of what RickM was suggesting - except rather than hard-coding all the axis values, I create a data-driven user-defined format (on-the-fly). Hard-coding all the values is a bit cumbersome, and if your data changes then the hard-coded values are incorrect, which could compromise the data integrity of the graph.
input x y;
data a; set a;
data control; set a (rename = ( data_order=start x=label));
fmtname = 'my_fmt';
type = 'N';
end = START;
proc format lib=work cntlin=control;
A nice trick, but a problem graph results. The integrity of the x axis is compromised - in the same way as when bars don't start at zero. I'm not a proponent of a broken scale, but this might be a use for one. Either that or leave out the 400 point and just post a note about it. And then the most important question - is this even the correct display mechanism for the data at hand?