Tuesday, March 11, 2014

SAS- Proc Report



SAS PROGRAMS FOR ABSOLUTE BEGINNERS BY AJEET KUMAR

* Proc Report Program Number: 1;
proc report data = class nowd headline headskip;
column name -- doj ni;
define doj / format=date9. 'date of joining' ;
define ni / computed 'new income' ;
compute ni;
if income < 10000 then ni = income * 1.10 ;
endcomp ;
run;

* Proc Report Program Number: 2;
proc report data = class;
run;

* Proc Report Program Number: 3;
proc report data = class nowindows;
run;

* Proc Report Program Number: 4;
proc report data = class nowd headline headskip;
column _all_;
run;

* Proc Report Program Number: 5;
proc report data = class nowd headline headskip;
column _character_;
run;

* Proc Report Program Number: 6;
proc report data = class nowd headline headskip;
column _numeric_;
run;

* Proc Report Program Number: 7;
proc report data = class nowd headline headskip;
column _numeric_;
define age / display ;
run;

* Proc Report Program Number: 8;
proc report data = class nowd headline headskip;
column Gender -- Doj;
run;

* Proc Report Program Number: 9;
proc report data = class nowd headline headskip;
column Gender -- Doj;
define Doj / format=date9. ;
run;

* Proc Report Program Number: 10;
proc format;
value $Genderx 'M' = 'Male' 'F' = 'Female';
value $statex   'UK' = 'Uttarakhand'
                        'RS' = 'Rajsthan'
                        'MP' = 'MadhyaPradesh';
run;

proc report data = class nowd headline headskip;
column Gender -- Doj;
define Doj / format=date9. ;
define State / format=$statex. ;
define Gender / format=$Genderx. ;
run;

* Proc Report Program Number: 11;
proc report data = class nowd headline headskip;
column Gender -- Doj;
define Doj / format=date9. ;
define State / group format=$statex. ;
define Gender / format=$Genderx. ;
run;

* Proc Report Program Number: 12;
proc report data = class nowd headline headskip;
column Gender -- Doj;
define Doj / format=date9. ;
define State /  format=$statex. ;
define Gender / group format=$Genderx. ;
run;

* Proc Report Program Number: 13;
proc report data = class nowd headline headskip;
column Gender -- Doj;
define Doj / format=date9. ;
define State / group format=$statex. ;
define Gender / group format=$Genderx. ;
run;

* Proc Report Program Number: 14;
proc report data = class nowd headline headskip;
column Gender -- Doj;
define Doj / format=date9. 'Date of Joining' ;
define State / group format=$statex. ;
define Gender / group format=$Genderx. ;
run;

* Proc Report Program Number: 15;
proc report data = class nowd headline headskip;
column Gender -- Doj;
define Doj / format=date9. 'Date of Joining' ;
define State / group format=$statex. center width=11;
define Gender / group format=$Genderx. ;
run;

* Proc Report Program Number: 16;
proc report data = class nowd headline headskip;
column Name -- Doj;
define Doj / format=date9. 'Date of Joining' ;
define Name / order format=$Genderx. ;
run;

* Proc Report Program Number: 17;
proc report data = class nowd headline headskip;
column Name -- Doj;
define Doj / format=date9. 'Date of Joining' ;
define Name / descending order format=$Genderx. ;
run;

* Proc Report Program Number: 18;
proc report data = class nowd headline headskip;
column Gender State,Income ;
define State / across format=$Statex. ;
define Gender / format=$Genderx. ;
run;

* Proc Report Program Number: 19;
proc report data = class nowd headline headskip MISSING ;
column Name -- income;
define Name / order format=$Genderx. ;
rbreak after / summarize dol dul;
run;

* Proc Report Program Number: 20;
proc report data = class nowd headline headskip split='\';
column name -- doj;
define doj / format=date9. 'date \of joining' ;
define name / order format=$genderx. ;
rbreak before / summarize dol dul;
run;

* Proc Report Program Number: 21;
proc report data = class nowd headline headskip;
column name -- doj;
define doj / format=date9. 'date of joining' ;
define state / order format=$genderx. ;
break after state / summarize dol dul;
run;

* Proc Report Program Number: 22;
proc report data = class nowd box headline headskip;
column name -- doj;
define doj / format=date9. 'date of joining' ;
define state / order format=$genderx. ;
break after state / summarize dol dul;
run;

* Proc Report Program Number: 23;
proc report data = class out= class2 nowd box headline headskip;
column name -- doj;
define doj / format=date9. 'date of joining' ;
define state / order format=$genderx. ;
break after state / summarize dol dul;
run;

* Proc Report Program Number: 24;
proc report data = class nowd headline headskip NOPRINT;
column name -- doj;
define doj / format=date9. 'date of joining' ;
define state / order format=$genderx. ;
break after state / summarize dol dul;
run;

No comments:

Post a Comment

Hot Topics