Hi Everyone.
I created a line chart in sas eg by taking a table as input which has date values of every Monday to Thursday. When I take last 7 days data from that table, I was getting non existing date values in my report also. Could anyone please help me out to get rid of them. Thanks. I've attached the sample report of it. As you see the below attached report, actually I don't have 11Nov, 12, 13 in my input table but still I was getting them that shouldn't happen.
Here's my code for line chart proc sgplot: Proc sgplot data=have nocycleattrs; Series x = dates y= A / lineattrs=(color=blue); Series x = dates y= B / lineattrs=(color=green); Series x = dates y= C / lineattrs=(color=red); run;
Your posted data does not contain the variables from the posted PROC SGPLOT Code.
However, I interpret your problem like this. You do not have 11, 12, 13 Nov in your data. So you do not want to display them in your graph.
You can add the line below in your code to achieve this.
xaxis type = discrete;
Can you attach some sample data? Makes it easier to help you.
Sure here it is :
Data have; Input in_date : date9. readings; format in_date date9.; Datalines; 08Nov2022 89 09NOV2022 61 10NOV2022 60 14NOV2022 53 15NOV2022 45 16NOV2022 15 17NOV2022 12 ; run;
This is not the dataset you use in your SGPLOT procedure, none of the variables used in the plot are there. Please post the real dataset with variables dates, a, b and c.
Extremely Sorry here it is.
Data have; Input dates : date9. A B C; format dates date9.; Datalines; 08Nov2022 89 468 120 09NOV2022 61 345 287 10NOV2022 60 900 111 14NOV2022 53 127 123 15NOV2022 45 460 430 16NOV2022 15 230 550 17NOV2022 12 310 589 ; run;
Your posted data does not contain the variables from the posted PROC SGPLOT Code.
However, I interpret your problem like this. You do not have 11, 12, 13 Nov in your data. So you do not want to display them in your graph.
You can add the line below in your code to achieve this.
xaxis type = discrete;
It worked, please fill your heart heartily thanked.
Heartily filled 🙂
To avoid autofill of dates, use VLINE instead of SERIES.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.