Tuesday, March 11, 2014

SAS- Proc Tabulate



SAS PROGRAMS FOR ABSOLUTE BEGINNERS BY AJEET KUMAR

* Proc Tabulate Program Number: 1 ;
proc tabulate data = class;
var Age Height Weight ;
table Age*Mean Height*Mean Weight*Mean ;
run;

* Proc Tabulate Program Number: 2 ;
proc tabulate data = class;
class Gender ;
table Gender ;
run;

* Proc Tabulate Program Number: 3 ;
proc tabulate data = class;
class Gender State;
table Gender State ;
run;

* Proc Tabulate Program Number: 4 ;
proc tabulate data = class;
class Gender State;
table Gender , State ;
run;

* Proc Tabulate Program Number: 5 ;
proc tabulate data = class;
class Gender State ;
var Age ;
table State , Gender , Age ;
run;

* Proc Tabulate Program Number: 6 ;
proc tabulate data = class;
class Gender State;
table Gender * State ;
run;

* Proc Tabulate Program Number: 7 ;
proc tabulate data = class;
class Gender State;
table Gender ALL , State ALL ;
run;

* Proc Tabulate Program Number: 8 ;
proc tabulate data = class;
var Age Height Weight ;
table Age Height Weight ;
run;

* Proc Tabulate Program Number: 9 ;
proc tabulate data = class format = comma9.2;
var Age Height Weight ;
table ( Age Height Weight ) * ( mean max min);
run;

* Proc Tabulate Program Number: 10 ;
proc tabulate data = class;
class Gender State ;
var Age Height Weight ;
table (Gender ALL ) * ( State ALL), ( Age Height Weight ) * mean ;
run;

* Proc Tabulate Program Number: 11 ;
proc tabulate data = class;
var Age Height Weight ;
table Age * mean * f = 7.1
      Height* mean * f = 8.2
      Weight* mean * f = 9.3 ;
run;

* Proc Tabulate Program Number: 12 ;
proc tabulate data = class;
var Age Height Weight ;
table Age * mean * f = 7.1
      Height* mean * f = 8.2
      Weight* mean * f = 9.3 ;
keylabel ALL = 'Total' mean = 'Average' ;
run;

* Proc Tabulate Program Number: 13 ;
proc tabulate data = class;
class Gender ;
table Gender * n = '' ;
run;

* Proc Tabulate Program Number: 14 ;
proc tabulate data = class format=8.2;
class Gender ;
table Gender * (n pctn);
run;

* Proc Tabulate Program Number: 15 ;
proc tabulate data = class format=7.2;
class Gender ;
table ( Gender all )*(n*f=6. pctn*f=7.1);
keylabel n = 'Total' pctn = 'Percent';
run;

No comments:

Post a Comment

Hot Topics