Published on :
Général CREATION_INTERNE

Sans titre

This code is also available in: Deutsch Español Français
Awaiting validation
Data Analysis

Type : CREATION_INTERNE


Data is manually created in the 'DATA step' 'countries' using the 'cards' statement.

1 Code Block
ODS / GOPTIONS
Explanation :
Configuration of the HTML output destination and definition of global graphic options (size, font, PNG format). Note: The 'c:\' paths are Windows-specific and will need to be adapted for a SAS Viya Linux environment.
Copied!
1ods html file='c:\test.html' gpath='c:\' ;
2goptions reset=all device=png
3 xmax=20 ymax=12 /* make PNG bigger */
4 ftext='Arial' htext=4pct /* use some nice looking text */;
2 Code Block
DATA STEP Data
Explanation :
Creation of the temporary SAS table 'countries' by reading raw data included in the script via 'cards' (datalines).
Copied!
1DATA countries;
2 INPUT country $ 1-14 region $16-26 Machinery;
3 CARDS;
4Taiwan Asia 6.1
5Korea Asia 4.6
6Malaysia Asia 4.4
7Malaysia2 Asia 3.9
8Malaysia4 Asia 3.9
9Malaysia5 Asia 1.5
10U.S. U.S. 39.1
11Belgium Europe 2.6
12Germany Europe 7.8
13United Kingdom Europe 3.9
14France Europe 3.9
15Santa Antarctica 1.1
16Bob Antarctica 1.0
17Cydonia Mars 1.1
18Tims House Mars 1.0
19China Asia 10.2
20Malaysia3 Asia 3.9
21;
22RUN;
3 Code Block
PROC GCHART
Explanation :
Generation of a pie chart based on the 'region' variable (SAS/GRAPH legacy). The 'Machinery' variable is used to weight the sum (sumvar). Options control the appearance of slices and labels.
Copied!
1PROC GCHART;
2 pie region / angle=320
3 slice=outside
4 percent=inside
5 value=none
6 sumvar=Machinery
7 detail_percent=best
8 detail=country
9 descending ;
10RUN; QUIT;
4 Code Block
ODS CLOSE
Explanation :
Closing the ODS HTML destination to finalize writing the file.
Copied!
1ods html close ;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.