03-22-2013 11:26 AM
I want to use SGPLOT to plot a uneven tick on x-axis in a proportional space but show all x value (see data below). how to do it? highly appreciate it for any suggestion.
03-22-2013 11:42 AM
This little example should work for you. Let me know if you have any questions about it.
input x y;
set mydata end=eof;
call symput('val'||left(trim(_n_)), trim(left(x)));
if eof then call symput('tot',trim(left(_n_)));
%do i= 1 %to &tot;
proc sort data=mydata; by x;
proc sgplot data=mydata noautolegend;
needle y=y x=x;
series y=y x=x;
03-24-2013 02:34 AM
I would be tempted to replace the macro and the DATA step with a SQL step
proc sql noprint;
select distinct x
into :values separated by ' '
the XAXIS statement becomes:
Dan the order of the values in the XAXIS statement does not seem to matter (I never noticed this before). Are there any issues with the values not being in order?
Message was edited by: Art Carpenter I left off the separated by phrase - added now
03-24-2013 04:11 AM
Does the DISTINCT impose order?
If not, muyi could extend the sql like:
Proc sql ;
Select distinct x
Into :values separated by ' '
ORDER BY x ;
Message was edited by: Peter Crawford Perhaps I should show the whole sql step