Hello,
I use proc sgplot . the group is the column "Profil" with 4 values NA, P1, P2 and P3.
the values of xaxis are N, N+1, N+2, N+3...(years)
The problem is the following : I would like that xaxis values are sorted like N, N+1, N+2...N+8. but as you can notice in the enclosed picture , they are not sorted because the profiles P1 P2 and P3 have the x values N, N+1, N+2 But the NA profil has x values N+5 to N+8.
Create another variable that maps N to 0, N+1 to 1, N+2 to 2, etc.
Then use that variable as your X axis, but create a format that displays it as N, N+1.
Create another variable that maps N to 0, N+1 to 1, N+2 to 2, etc.
Then use that variable as your X axis, but create a format that displays it as N, N+1.
thank you very much Reeza for you quick answer.
I create the new variable but only 0 2 4 6 8 are displayed. 1 3 5 7 are missing on the x axis
I succed to get the correct values in x axis by using min max values in variable and then I can do this :
xaxis display = (nolabel) discreteorder = FORMATTED values=(&v_min_xaxis. to &v_max_xaxis. by 1) ;
Hello Reeza
I don't succeed to create a format that displays (0,1,2,3...) as N, N+1, N+2...
Thanks a lot in advance for your help
Nasser
I succeeded to create the format like this
proc format ; picture Format_Year_Suite low-high = '00' (prefix='N + ') ; run;
and then within the proc sgplot I mentionne
format Suite_Year_4_Sort Format_Year_Suite. ;
the problem is that it works for all numbers except 0 which is not displays.
Perhaps something like:
proc format library=work; picture Format_Year_Suite 0 = 'N' (noedit) 0<-high = '09' (prefix='N + ') ; run; data _null_; do x= 0 to 10; put x= best5. +1 x= format_year_suite.; end; run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.