Basics Of Proc Tabulate - Sas Institute

2y ago
119 Views
2 Downloads
1.44 MB
26 Pages
Last View : 28d ago
Last Download : 3m ago
Upload by : Noelle Grant
Transcription

Basics of Proc TabulateAnky LaiCancer Surveillance & Outcomes (CSO)Population OncologyBC Cancer Agency

Introduction What is Proc Tabulate?– A procedure that displays descriptive statistics in tabular format But aren’t there other procs that do thesame thing

“I want summary stats on students’ ages and heights, overall and by gender.”proc means data sashelp.class;var age height;run;proc means data sashelp.class;class sex;var age height; run;proc tabulate data sashelp.class;class sex;var age height;table (age height)*(N MEAN STD MINMAX), SEX ALL; run;

Introduction Why––––should you use it?Payoff is in the outputSaves a lot of timeReduces errorsEasy to format tables

Outline PROC TABULATE basics Customize tables Export tables

Proc Tabulate Basics Basic syntax:(1)proc tabulate data dataset options ;(2)class variable(s) /option(s) ; variables used in PROC FREQ*And/Or*var variable(s) /option(s) ; variables used in PROC MEANS(3)table

, row , column /table-option(s) ; run;

Table Statement All variables listed in the TABLE statement mustbe listed in CLASS or VAR More than one TABLE statement can be used The order of the variables in the statement will bethe same as the output table

Table Statement Create 1, 2, or 3 dimensional tables:– 1 dimensional (no commas):Syntax: table columndimension / options ;– 2 dimensional (1 comma):Syntax:table row dimension , column dimension / options ;– 3 dimensional (2 commas):Syntax: table

, row , column / options ;

Table Statement Operators to use in each dimension:1) Asterisk (*) adding a classification variable adding another statistic2) Parentheses ( ) group elements and simplify coding and output3) ‘space’ places output for each element immediately after the output of the preceding.4) All calculate row or column totals

Dataset Dataset: sashelp.CARS (N 428) Set up dataset as you would have it for PROC FREQ orPROC MEANS Examples done in SAS V9.3

1-Dimensional Tables Basic exampleproc tabulate data sashelp.CARS;var MSRP;class TYPE DRIVETRAIN;table MSRP;table TYPE DRIVETRAIN; run;Output:

1-Dimensional Tables Adding a classification variable Syntax: variable name * class variable proc tabulate data sashelp.CARS ;var MSRP;class TYPE DRIVETRAIN;table MSRP*TYPE MSRP*DRIVETRAIN; run;Output:

1-Dimensional Tables Adding another statistic Syntax: variable name *statistic-keyword

1-Dimensional Tables1) Add similar code to Table statementproc tabulate data sashelp.CARS;class TYPE;var MSRP ;table MSRP*TYPE*sum MSRP*TYPE*mean;run;Output:Output:2) Use parenthesesproc tabulate data sashelp.cars;class TYPE;var MSRP ;table MSRP*TYPE*(sum mean);table MSRP*(sum mean)*TYPE ;run;

1-Dimensional Tables Use ‘ALL’ to calculate overall statistics Treat as a classification variableproc tabulate data sashelp.cars ;class TYPE;var MSRP ;table TYPE ALL (TYPE ALL)*MSRP*MEAN; run;Output:

Customizing 2-D Tableproc tabulate data sashelp.cars ;class DRIVETRAIN ORIGIN TYPE ;var MSRP HORSEPOWER;table ALL (DRIVETRAIN TYPE)*(N COLPCTN)(MSRP TYPE*HORSEPOWER)*(MEAN STD),(ORIGIN ALL);run;

Customizing 2-D Table Print missing dataproc tabulate data cars missing;class DRIVETRAIN ORIGIN TYPE ;var MSRP HORSEPOWER;table ALL (DRIVETRAIN TYPE)*(N COLPCTN)(MSRP TYPE*HORSEPOWER)*(MEAN STD),(ORIGIN ALL);run;

Customizing 2-D Table Right align levels and statistic labelsproc tabulate data sashelp.cars;class DRIVETRAIN ORIGIN TYPE ;classlev DRIVETRAIN TYPE/s [just right];var MSRP HORSEPOWER;tableALL(DRIVETRAIN TYPE)*(N {s [just right]}COLPCTN {s [just right]})(MSRPTYPE*HORSEPOWER)*(MEAN {s [just right]})STD {s [just right]} ), (ORIGIN ALL);run;

Customizing 2-D Table Edit headings and statistics keywordsproc tabulate data sashelp.cars ;class DRIVETRAIN ORIGIN TYPE ;classlev DRIVETRAIN TYPE / s [just right];keylabel COLPCTN '%' ;var MSRP HORSEPOWER;tableALL (DRIVETRAIN 'Drive Type' TYPE)*(N {s [just right]}COLPCTN {s [just right]})(MSRP TYPE*HORSEPOWER)*(MEAN {s [just right]}STD {s [just right]}),(ORIGIN '' ALL 'Total') / box 'Car Stats';run;

Customizing 2-D Table Edit values (change formats, replace missing values)proc tabulate data sashelp.cars ;class DRIVETRAIN ORIGIN TYPE ;classlev DRIVETRAIN TYPE / s [just right];keylabel COLPCTN '%' ;var MSRP HORSEPOWER;tableALL(DRIVETRAIN 'Drive Type' TYPE)*(N {s [just right]}COLPCTN {s [just right]}*f 5.1)(MSRPTYPE*HORSEPOWER)*(MEAN {s [just right]}*f dollar10.1STD {s [just right]}),(ORIGIN '' ALL 'Total') / box 'Car Stats' misstext '0';run;

Customizing 2-D Table Edit order of categoriesproc format;value drivefmt (notsorted)'Front' 'FRONT''Rear' ‘BACK''All' 'ALL';run;proc tabulate data sashelp.cars ;class ORIGIN TYPE ;class DRIVETRAIN/preloadfmt order data;classlev DRIVETRAIN TYPE / s [just right];var MSRP HORSEPOWER;table ALL (DRIVETRAIN 'Drive Type' TYPE)*(NCOLPCTN '%'*f 5.1) (MSRPTYPE*HORSEPOWER)*(MEAN*f dollar10.1 STD),(ORIGIN '' ALL 'Total')/misstext '0'box 'Cars Stats';format DRIVETRAIN drivefmt.; run;

Exporting to Excelods tagsets.excelxp file ‘C:\My Documents\exampletable.xml'style statisticaloptions(ABSOLUTE COLUMN WIDTH "10,10,6,6,6,6,6" EMBEDDED TITLES 'yes'SHEET NAME 'CARS');title 'Descriptive Statistics for CARS dataset';proc tabulate data sashelp.cars ;class ORIGIN TYPE ;class DRIVETRAIN/preloadfmt order data;classlev DRIVETRAIN TYPE / s [just right];keylabel COLPCTN '%' ;var MSRP HORSEPOWER;table ALL (DRIVETRAIN 'Drive Type' TYPE)*(N {s [just right]}COLPCTN {s [just right]}*f 5.1) (MSRPTYPE*HORSEPOWER)*(MEAN {s [just right]}*f dollar10.1STD {s [just right]}), (ORIGIN '' ALL 'Total')/box 'Car Stats'misstext '0';format DRIVETRAIN drivefmt.;run;ods tagsets.excelxp close;

Exporting to Excelods tagsets.excelxp file ‘C:\My Documents\exampletable.xml'style statisticaloptions(ABSOLUTE COLUMN WIDTH "10,10,6,6,6,6,6" EMBEDDED TITLES 'yes'SHEET NAME 'CARS');title 'Descriptive Statistics for CARS dataset';proc tabulate data sashelp.cars ;class ORIGIN TYPE ;class DRIVETRAIN/preloadfmt order data;classlev DRIVETRAIN TYPE / s [just right];keylabel COLPCTN '%' ;var MSRP HORSEPOWER;table ALL (DRIVETRAIN 'Drive Type'TYPE)*(N {s [just right]} COLPCTN {s [just right]}*f 5.1)(MSRP TYPE*HORSEPOWER)*(MEAN {s [just right]}*f dollar10.1STD {s [just right]}), (ORIGIN '' ALL 'Total')/box 'CarStats' misstext '0';format DRIVETRAIN drivefmt.;run;ods tagsets.excelxp close;

proc format;value originfmt'USA' gif';value numfmt. 'Orange‘0-200 'Blue‘201-1000 'Purple‘1001-high 'Red'; run;ods html file 'U:\My Documents\exampletable.html';proc tabulate data sashelp.cars S [foreground numfmt.];class TYPE / s [background pink foreground blue];class ORIGIN / s [background pink foreground blue];class DRIVETRAIN/preloadfmt order data s [background pinkforeground blue];classlev DRIVETRAIN TYPE / s [just rightbackground purple foreground white];classlev ORIGIN / S [Vjust T postimage originfmt.];keylabel COLPCTN '%' ;var MSRP HORSEPOWER;table ALL (DRIVETRAIN 'Drive Type'TYPE)*(N {s [just right color green]}COLPCTN {s [just right color redbackground orange]}*f 5.1) (MSRPTYPE*HORSEPOWER)*(MEAN {s [just right]}*f dollar10.1STD {s [just right]}), (ORIGIN '' ALL 'Total')/box 'Car Stats' misstext '0';format DRIVETRAIN drivefmt. ;run;ods html close;

References s09/039-2009.pdf

proc means data sashelp.class; var age height; run; proc means data sashelp.class; class sex; var age height; run; “I want summary sta

Related Documents:

POStERallows manual ordering and automated re-ordering on re-execution pgm1.sas pgm2.sas pgm3.sas pgm4.sas pgm5.sas pgm6.sas pgm7.sas pgm8.sas pgm9.sas pgm10.sas pgm1.sas pgm2.sas pgm3.sas pgm4.sas pgm5.sas pgm6.sas pgm7.sas pgm8.sas pgm9.sas pgm10.sas 65 min 45 min 144% 100%

SAS OLAP Cubes SAS Add-In for Microsoft Office SAS Data Integration Studio SAS Enterprise Guide SAS Enterprise Miner SAS Forecast Studio SAS Information Map Studio SAS Management Console SAS Model Manager SAS OLAP Cube Studio SAS Workflow Studio JMP Other SAS analytics and solutions Third-party Data

Both SAS SUPER 100 and SAS SUPER 180 are identified by the “SAS SUPER” logo on the right side of the instrument. The SAS SUPER 180 air sampler is recognizable by the SAS SUPER 180 logo that appears on the display when the operator turns on the unit. Rev. 9 Pg. 7File Size: 1MBPage Count: 40Explore furtherOperating Instructions for the SAS Super 180www.usmslab.comOPERATING INSTRUCTIONS AND MAINTENANCE MANUALassetcloud.roccommerce.netAir samplers, SAS Super DUO 360 VWRuk.vwr.comMAS-100 NT Manual PDF Calibration Microsoft Windowswww.scribd.com“SAS SUPER 100/180”, “DUO SAS SUPER 360”, “SAS .archive-resources.coleparmer Recommended to you b

This introduction to PROC TABULATE first looks at the basic syntax of PROC TABULATE and then, using a series of examples, shows how to produce one, two and three dimensional tables. The paper also illustrates how to use the TABLE statement and the difference between the CLASS and VAR statements. Also discussed are adding statistics for the table (including percents), labeling variables and .

proc gplot, proc sgplot, proc sgscatter, proc sgpanel, . In SAS/Graph: proc gcontour, proc gchart, proc g3d, proc gmap, Stat 342 Notes. Week 12 Page 26 / 58. KDE stands for Kernel Density Estimation. It's used to make a smooth estimation of the probability density of a distribution from the points in a data set.

Both SAS SUPER 100 and SAS SUPER 180 are identified by the “SAS SUPER 100” logo on the right side of the instrument. International pbi S.p.AIn « Sas Super 100/180, Duo Sas 360, Sas Isolator » September 2006 Rev. 5 8 The SAS SUPER 180 air sampler is recognisable by the SAS SUPER 180 logo that appears on the display when the .File Size: 1019KB

Jan 17, 2018 · SAS is an extremely large and complex software program with many different components. We primarily use Base SAS, SAS/STAT, SAS/ACCESS, and maybe bits and pieces of other components such as SAS/IML. SAS University Edition and SAS OnDemand both use SAS Studio. SAS Studio is an interface to the SAS

SAS Stored Process. A SAS Stored Process is merely a SAS program that is registered in the SAS Metadata. SAS Stored Processes can be run from many other SAS BI applications such as the SAS Add-in for Microsoft Office, SAS Information Delivery Portal, SAS Web