Hi, I am very beginner in SAS. I have date variable and 'daily COVID cases' variable.
When I make sgplot (xaxis=date and yaxis=# of cases), I only get a few tick marks on x axis. I want to add tick marks for each day. I have been searching to solve this problem for 4 days but none of article worked or I couldn't understand their explanations.....again I am very beginner, please explain basic details if you can.. Thank you so much.
This is my code.
What should be fixed?
proc sgplot data=after;
series x=date y=New_cases_fu;
xaxis interval=day label=' ' values=('08JUL2020'd to '16sep2020'd by 1) ;
yaxis label=" New cases";
RUN;
With your apparent current format if you managed to get all those tick marks you would have a LOT of collisions of text.
Daily tick marks over a period of more than 30 day are really overkill and tend to create messy axis appearance.
You can use VALUESROTATE=vertical on the xaxis statement toreduce collision and maybe
values=('08JUL2020'd to '16sep2020'd by day)
change the format to something like format date date7. to use less text as well.
Personally I would likely use a "by week" as your data shows a very typical weekly sort of cycle where some data is likely postponed and reported on the next day (Probably a Monday)
With your apparent current format if you managed to get all those tick marks you would have a LOT of collisions of text.
Daily tick marks over a period of more than 30 day are really overkill and tend to create messy axis appearance.
You can use VALUESROTATE=vertical on the xaxis statement toreduce collision and maybe
values=('08JUL2020'd to '16sep2020'd by day)
change the format to something like format date date7. to use less text as well.
Personally I would likely use a "by week" as your data shows a very typical weekly sort of cycle where some data is likely postponed and reported on the next day (Probably a Monday)
OMG......!! It worked. I am so happy and thankful!
It is funny how it easily works when I know what to do. I spend 4 days with this problem, and I am frustrated with my skill.
If it is okay, how can I increase me skill in SAS, does anyone have a good advise? Should I read a book, or do a lot of projects? where can I practice SAS gradually?
I really want to be good at this but I don't know where to start...
@htst1003 wrote:
OMG......!! It worked. I am so happy and thankful!
It is funny how it easily works when I know what to do. I spend 4 days with this problem, and I am frustrated with my skill.
If it is okay, how can I increase me skill in SAS, does anyone have a good advise? Should I read a book, or do a lot of projects? where can I practice SAS gradually?
I really want to be good at this but I don't know where to start...
There are free training courses available.
The documentation for many procedures show at least the basics: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=pgmsashome&docsetTarget=h...
you can even search for topics.
Graphing examples with data: https://support.sas.com/en/knowledge-base/graph-samples-gallery.html
I started with SAS before the internet was much of an issue. I had access to a stack of documentation books about 2 feet thick. I used them. A lot.
Start with one of the examples. Try options available in the documentation for procedures or statements and see what the result is.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.