Hi,
I am learning SAS Studio. I want to create Bar chart in SAS Studio. I have data set with row count of 7453215. When I am execute SAS program to create Bar Chart it throws me following error.
ERROR: The data to be rendered has exceeded the MAXOBS limit of 2000000. You can set MAXOBS=7453215 on the ODS GRAPHICS statement to render the graph.
ods graphics / reset width=6.4in height=4.8in imagemap;
proc sgplot data=MYLIB.TBL2007;
vbar FlightNum / group=Year groupdisplay=cluster;
yaxis grid;
run;
ods graphics / reset;
run;
And what happened with maxobs set to 7453215?
The log is text, so please post is using {i} icon.
You have hit a limitation of not just SAS, but the human eye. No graph should be displaying 7453215 observations, a normal size graph would not have space to display a fraction of this.
Summarise your data by your categories - this will be x or y axis depending on direction of bar, then plot the summarised data. For instance, if I have a dataset with subject,age and val with 20,000 records I could try plotting that, or I could ascertain what categories I want to see in my graph and then summarise (maybe mean, high/low, standard deviation etc.).
"But what if i want to analyse all record for particular purpose" - please define.
I would recommend you summarise. The point of a graph is to show in simple shapes the data, plotting every single point in a dataset will almost never create a viewable graph. Decide what you want to see in the graph, what is the bar your trying to show, is it the maximum, or the count or something else. Then organise the data to show just the results you want to see, then plot those. A simple example, I could take the data from sashelp.class, and plot M/F against age, this would make my Xaxis have lots of individual columns, as there are many ages. This is not conducive to easily looking at the data, so in this instance I take the decision to sum by age category which I create, in this way I may have 3 or 4 xaxis columns, and the data is easy to view. Without knowing your problem I cant suggest.
Try setting your maxobs higher:
ods graphics on / obsmax=11000000;
proc sgplot data=out;
scatter y=y x=x/group=cluster;
run;
ods graphics off;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.