Hi all, I'm trying to learn base SAS, so forgive the simple questions.
I use the following code, following the instructions from SAS Programming 1 Essentials, Lesson 5, Practice 1, Level 2. Here's the code:
I confirm the library is correct and it does generate results, but I cannot figure out why I keep getting this error:
ERROR: Unable to establish ODS Graphics context.
It doesn't want to set up a graph. Is this something it doesn't support? Note I do have the beginning line "ods graphics on;" and per the learning that's supposed to let me make graphs. Is that not in OnDemand? Is there another setting in OnDemand I need to flag/remove to get this to behave?
ods graphics on;
title "Selected Park Types by Region";
proc freq data=pg1.np_codelookup order=freq;
tables Type*Region / nocol crosslist
plots=freqplot (groupby=row scale=grouppercent orient=horizontal);
where Type in ("National Historic Site", "National Monument", "National Park");
run;
title;Screenshot attached so you don't have to hunt through everything...I think I have it right. What am I missing?
Thanks,
Ryan C
Looking at the solution, I think this trip up here was that I used "title" and not "title1". Someone confirm if that was the issue. Thanks!
Best would be to show the LOG. Copy the code and all of the other messages from the log. Suggest starting a new session and only running the code to assign the library/data set and the steps you show. If you get the same results then show that log. The new session means there will be less stuff to wade through that might be involved.
That sort of error is a bit odd and may relate to something else you had done earlier, possibly related to which ODS destination(s) are open.
Your question about the Title statement I would say is not likely to be the issue. The use of Title as the same as Title1 goes back about 40 years so I doubt very strongly that it has any effect.
Hi both,
So doing as instructed, the new session doesn't care about "title" vs "title1", so that doesn't look like its the problem as you suggested; it runs fine now. does SAS OnDemand for Academics have some setting with ODS? I don't have a "user" option (at least, in this point of the Base SAS learnings I haven't found any reference to it, so I haven't come across it). I understand it exists, I researched and saw the same thing in the documentation, I just don't know why that error flagged yesterday, and now today it's working just fine.
I'm extremely confused. Is this a "quirk" of SAS?
As requested, code from today and log file:
ods graphics on;
title "Selected Park Types by Region";
proc freq data=pg1.np_codelookup order=freq;
tables Type*Region / nocol crosslist
plots=freqplot (groupby=row scale=grouppercent orient=horizontal);
where Type in ("National Historic Site", "National Monument", "National Park");
run;
title;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74 ods graphics on;
75 title "Selected Park Types by Region";
76 proc freq data=pg1.np_codelookup order=freq;
77 tables Type*Region / nocol crosslist
78 plots=freqplot (groupby=row scale=grouppercent orient=horizontal);
79 where Type in ("National Historic Site", "National Monument", "National Park");
80 run;
NOTE: There were 204 observations read from the data set PG1.NP_CODELOOKUP.
WHERE Type in ('National Historic Site', 'National Monument', 'National Park');
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.42 seconds
user cpu time 0.17 seconds
system cpu time 0.02 seconds
memory 26144.65k
OS Memory 52916.00k
Timestamp 11/14/2025 03:35:35 PM
Step Count 47 Switch Count 4
Page Faults 0
Page Reclaims 6898
Page Swaps 0
Voluntary Context Switches 443
Involuntary Context Switches 9
Block Input Operations 0
Block Output Operations 1632
81 title;
82
83 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
95
Dive into keynotes, announcements and breakthroughs on demand.
Explore Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.