Hello,
I am trying to create timeseries graph using proc sgplot but in my case there are multiple records available for single date.this causes following graph to be formed.Here i have two rows for 21 jan .
instead i would like to make graph like this:
Is there any way to get 2nd graph?
I am using this code:
proc sgplot data=work.limits;
series x=time_stamp y=test_value/markers ;
refline &bin_lsl/axis=Y label= 'LSL&bin_lsl.' lineattrs=(color ='green' thickness=2 pattern =dashdashdot);
refline &bin_usl/axis=Y label= 'USL&bin_usl.' lineattrs=(color ='green' thickness=2 pattern =dashdashdot);
xaxis discreteorder=data fitpolicy=rotate display=all;
yaxis grid max=&bin_usl min = &bin_lsl ;
You need to sort the data by the X variable. There is not a unique way to plot data that has duplicate X values, but in your example you are plotting the high value before the low values, so run the following before you call PROC SGPLOT:
proc sort data=work.limits;
by time_stamp test_value;
run;
Remove duplicate records before doing the graph?
You need to sort the data by the X variable. There is not a unique way to plot data that has duplicate X values, but in your example you are plotting the high value before the low values, so run the following before you call PROC SGPLOT:
proc sort data=work.limits;
by time_stamp test_value;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.