data Color;
input Region Eyes $ Hair $ Count @@;
label Eyes ='Eye Color'
Hair ='Hair Color'
Region='Geographic Region';
datalines;
1 blue fair 23 1 blue red 7 1 blue medium 24
1 blue dark 11 1 green fair 19 1 green red 7
1 green medium 18 1 green dark 14 1 brown fair 34
1 brown red 5 1 brown medium 41 1 brown dark 40
1 brown black 3 2 blue fair 46 2 blue red 21
2 blue medium 44 2 blue dark 40 2 blue black 6
2 green fair 50 2 green red 31 2 green medium 37
2 green dark 23 2 brown fair 56 2 brown red 42
2 brown medium 53 2 brown dark 54 2 brown black 13
;
ods html style=statistical;
ods graphics on;
proc freq data=Color;
tables Eyes Hair Eyes*Hair ;
weight Count;
run;
ods graphics off;
ods html close;
The Code Above is not generating any Graphics in SEG only tables. Please can anyone see what is wrong? The code was copied from the SAS website which shows examples of the charts produced by the same code, see here:
Frequency Bar Charts with PROC FREQ (sas.com)
The Log File, shows no errors:
1 The SAS System 09:59 Friday, May 26, 2023
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='Test Code';
4 %LET _CLIENTPROCESSFLOWNAME='Juriya Validated Farmers';
5 %LET _CLIENTPROJECTPATH='C:\DataAnalysis\KOBOWEB\SEG Projects\Analyse NAAS Farm Data\Analyse_JURIYA_FarmData_01.egp';
6 %LET _CLIENTPROJECTPATHHOST='PRECISION5470';
7 %LET _CLIENTPROJECTNAME='Analyse_JURIYA_FarmData_01.egp';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=PNG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 %macro HTML5AccessibleGraphSupported;
15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) >= 0 %then ACCESSIBLE_GRAPH;
16 %mend;
17 FILENAME EGHTML TEMP;
18 ODS HTML5(ID=EGHTML) FILE=EGHTML
19 OPTIONS(BITMAP_MODE='INLINE')
20 %HTML5AccessibleGraphSupported
21 ENCODING='utf-8'
22 STYLE=HTMLBlue
23 NOGTITLE
24 NOGFOOTNOTE
25 GPATH=&sasworklocation
26 ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
27
28 data Color;
29 input Region Eyes $ Hair $ Count @@;
30 label Eyes ='Eye Color'
31 Hair ='Hair Color'
32 Region='Geographic Region';
33 datalines;
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.COLOR has 27 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
43 ;
44
45 ods html style=statistical;
NOTE: Writing HTML Body file: sashtml12.htm
46 ods graphics on;
47
48 proc freq data=Color;
49 tables Eyes Hair Eyes*Hair ;
50 weight Count;
51 run;
NOTE: There were 27 observations read from the data set WORK.COLOR.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.14 seconds
cpu time 0.06 seconds
2 The SAS System 09:59 Friday, May 26, 2023
52
53 ods graphics off;
54 ods html close;
55
56 %LET _CLIENTTASKLABEL=;
57 %LET _CLIENTPROCESSFLOWNAME=;
58 %LET _CLIENTPROJECTPATH=;
59 %LET _CLIENTPROJECTPATHHOST=;
60 %LET _CLIENTPROJECTNAME=;
61 %LET _SASPROGRAMFILE=;
62 %LET _SASPROGRAMFILEHOST=;
63
64 ;*';*";*/;quit;run;
65 ODS _ALL_ CLOSE;
66
67
68 QUIT; RUN;
69
You need to ask PROC FREQ to produce plots. Example:
tables Eyes*Hair / plots=freqplot;
You need to ask PROC FREQ to produce plots. Example:
tables Eyes*Hair / plots=freqplot;
Thanks so much, this works as well.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.