Proc Print :
This procedure prints out all or some of the variables in SAS dataset
And optionally prints out totals and subtotals for numeric variables.
Syntax:-
PROC PRINT <OPTIONS>;
VAR VARIABLE-LIST;
ID VARIABLE- LIST;
BY VARIABLE-LIST;
PAGE BY BY-VARIABLE;
SUM BY BY-VARIABLE;
SUM VARIABLE –LIST;
RUN;
Examples:-
Prints recent created dataset.
PROC PRINT;
RUN;
Options:-
Data=dataset – Specify sas dataset name which you are printing.
Otherwise it prints recent created dataset.
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA;
RUN;
Noobs – Suppresses printing of obs column.
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS;
RUN;
Obs = Name – Assigns a name for Obs column
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA OBS=’Stansys’;
RUN;
Heading=Vertical – Prints Column names vertically in output default is horizontal.
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA OBS=’Stansys’ HEADING=VERTICAL;
RUN;
Double – Write a blank line between observations
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE;
RUN;
Blankline= Write a blank line after n observations
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS BLANKLINE=5;
RUN;
N – Prints no of observations.
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N;
RUN;
Label – Variable labels as column headings.
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N LABEL;
LABEL SEX=GENDER INCOME=SALARY;
RUN;
Sumlabel – Display the BY variable label on the summary line
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS LABEL SUMLABEL;
LABEL SEX=GENDER INCOME=SALARY;
BY ZONE;
RUN;
Spilt – The label for variables is split across multiple lines
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’;
LABEL SEX=GENDER
INCOME=SALARY
EMP_ID=EMPLOYEE*ID
EMP_NAME=EMPLOYEE*NAME;
RUN;
Uniform – Formats all pages uniformly.
PROC PRINT DATA= My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM;
LABEL SEX=GENDER
INCOME=SALARY
EMP_ID=EMPLOYEE*ID
EMP_NAME=EMPLOYEE*NAME;
RUN;
Width= column-width
Determines the column width for each variable. The value of column-width must be one of the following:

Style-element-name – Is the name of a style element that is part of a style definition that is registered with the Output Delivery System. SAS provides some style definitions. Users can create their own style definitions with PROC TEMPLATE.
When style elements are processed, more specific style elements override less specific style elements.

Style-attribute-specification
Describes the style attribute to change. Each style-attribute-specification has this general form: style-attribute-name=style-attribute-value
You can set these following style attributes in the TABLE location:
BACKGROUNDCOLOR= FONTWIDTH=* BACKGROUNDIMAG=
COLOR=* BORDERCOLOR= FRAME=
BORDERCOLORDARK= HTMLCLASS= BORDERCOLORLIGHT=
TEXTALIGN= BORDERWIDTH= OUTPUTWIDTH=
CELLPADDING= POSTHTML= CELLSPACING=
POSTIMAGE= FONT=* POSTTEXT=
FONTFAMILY=* PREHTML= FONTSIZE=*
PREIMAGE= FONTSTYLE=* PRETEXT=
FONTWEIGHT=* RULES=
* When you use these attributes, they affect only the text that is specified with the PRETEXT=, POSTTEXT=, PREHTML=, and POSTHTML= attributes.
To alter the foreground color or the font for the text that appears in the table, you must set the corresponding attribute in a location that affects the cells rather than the table.
You can set these style attributes in all locations other than TABLE:
ASIS= FONTWIDTH= BACKGROUNDCOLOR=
HREFTARGET= BACKGROUNDIMAGE= CLASS=
BORDERCOLOR= TEXTALIGN= BORDERCOLORDARK=
NOBREAKSPACE= BORDERCOLORLIGHT= POSTHTML=
BORDERWIDTH= POSTIMAGE= HEIGHT=
POSTTEXT= CELLWIDTH= PREHTML=
FLYOVER= PREIMAGE= FONT=
PRETEXT= FONTFAMILY= PROTECTSPECIALCHARS=
FONTSIZE= TAGATTR= FONTSTYLE=
URL= FONTWEIGHT= VERTICALALIGN=
Statements with Options
Var Statement: – To select the variables which we required into output
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
RUN;
Where Statement: – Select data into output based on condition
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
WHERE SEX=’M’;
/*WHERE SEX=’F’;*/
RUN;
ID Statement: – ID variable comes the position of OBS place.
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
ID ZONE;
RUN;
After remove ZONE from VAR statement.
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
ID ZONE;
RUN;
BY Statement: – Prints data separately on each group of BY variable.
Where ever we are using by statement, it should be in sorting order
PROC SORT DATA=My_SAS.DEMOGRAPHIC_DATA;
BY ZONE;
RUN;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
BY ZONE;
RUN;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
ID ZONE;
BY ZONE;
RUN;
PAGEBY Statement: – Prints data separately on each group of BY variable in Separate page.
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
BY ZONE;
PAGEBY ZONE;
RUN;
SUMBY Statement: – Prints subtotals and totals for all the numeric variables,
Prints subtotals based on each group of BY variable
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX AGE INCOME;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
RUN;
SUM Statement: – Prints subtotals and totals for specific numeric variables
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX AGE INCOME;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
RUN;
TITLE: – Assigns title for the report, generally it should be in top of the report
The default title is SAS SYSTEM
It is a global option, u can write anywhere in the program
Maximum we can write 10 titles.
FOOTNOTE: – Assigns footnote for the report, generally it should be bottom of the report
It is a global option, u can write anywhere in the program
Maximum we can write 10 footnotes.
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX AGE INCOME;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title ‘ Employee Demographic Data’;
Title2 ‘Stansys Software Solutions ‘;
Footnote ‘Generated By Mr. Krishna ‘;
RUN;
Options Titles & Footnotes
Justify=Left/Right (or) Justify=L/R (or) J=Left/Right (or) J=L/R
Justify left/right alignment of Titles and Footnotes. Default is center aligned.
Color=Color name (or) C=Color name
Applies color for Titles and Footnotes.
Font=Font name (or) F=Font
Applies font name for Titles and Footnotes.
Height=Height size (or) H= Height size
Applies size of letters for Titles and Footnotes.
Bold/Italic
Titles and Footnotes letters will become bold/italic.
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX AGE INCOME;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title j=l c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 j=r c=blue f=Arial h=6 ‘Stansys Software Solutions ‘;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
To remove Titles and Footnotes
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX AGE INCOME;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title ‘ ‘;
Title2;
Footnote;
RUN;
Applying styles in proc print
PROC FORMAT;
VALUE $val ‘F’=’RED’
‘M’=’GREEN’;
RUN;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME INCOME SEX/style=[foreground=$val.] ;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title j=l c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 j=r c=blue f=Arial h=6 ‘Stansys Software Solutions ‘;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
Converting Report into user format HTML
ODS HTML
FILE=”C:\Documents and Settings\Neeru\Desktop\Reports\Demographic.html”;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME INCOME SEX/style=[background=$val.] ;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 c=red f=Arial h=7 ‘Neeru Technologies ‘;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;
Converting Report into user format Pdf
ODS PDF
FILE=”C:\Documents and Settings\Neeru\Desktop\Reports\Demographic.PDF” NOTOC;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME INCOME SEX/style=[foreground=$val.] ;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 c=red f=Arial h=7 ‘Neeru Technologies ‘;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PDF CLOSE;
Converting Report into user format Excel
ODS tagsets.excelxp
FILE=”C:\Documents and Settings\Neeru\Desktop\Reports\Demographic.xls” ;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME INCOME SEX/style=[foreground=$val.] ;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 c=red f=Arial h=7 ‘Neeru Technologies ‘;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS tagsets.excelxp CLOSE;
Customizing PROC PRINT Output with the STYLE= Option
We can use different styles to change overall look of any output which produce thru proc print, proc report & proc tabulate by using STYLE=OPTION in proc step.
Syntax:- PROC PRINT STYLE(location-list) = {style-attribute = value};
Location – List like
DATA (all the data cells)
HEADER ( the column headers (variable names))
OBS (the data in the OBS column, or ID column if using an ID statement)
OBSHEADER (the header for the OBS or ID column)
TOTAL (the data in the totals row produced by a SUM statement)
GRANDTOTAL (the data for the grand total produced by a SUM statement)
Example:-
DATA DS;
SET SASHELP.CLASS;
RUN;
PROC SORT DATA=DS;
BY SEX;
RUN;
ODS HTML FILE=”C:\Documents and Settings\Administrator\Desktop\sas\Demo.htm”;
PROC PRINT STYLE(DATA) = {BACKGROUND = pink};
/*PROC PRINT STYLE(HEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBS) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(OBSHEADER) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(TOTAL) = {BACKGROUND = pink};*/
/*PROC PRINT STYLE(GRANDTOTAL) = {BACKGROUND = pink};*/
PROC PRINT DATA=DS NOOBS;
VAR NAME SEX AGE HEIGHT WEIGHT;
BY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;
In above example style is applying for entire table(for all variables one style)
But if you want to apply different styles for different variables see below program.
Syntax:-VAR variable / STYLE(location-list) = {style-attribute = value};
ODS HTML FILE=”C:\Documents and Settings\Administrator\Desktop\sas\DEMO.HTM”;
PROC PRINT DATA=DS NOOBS;
VAR NAME/STYLE(DATA)={BACKGROUND=RED FOREGROUND=YELLOW} ;
VAR SEX ;
VAR AGE ;
VAR HEIGHT ;
VAR WEIGHT;
BY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;
ODS HTML FILE=”C:\Documents and Settings\Administrator\Desktop\mysas\DEMO.HTM”;
PROC PRINT DATA=DS NOOBS;
VAR NAME/STYLE(DATA)={BACKGROUND=yellow FOREGROUND=RED} ;
VAR SEX /STYLE(HEADER)={BACKGROUND=CYAN} ;
VAR AGE /STYLE(DATA)={BACKGROUND=orange FOREGROUND=BLUE} ;
VAR HEIGHT /STYLE(DATA)={BACKGROUND=GWH } ;
VAR WEIGHT/STYLE(HEADER)={BACKGROUND=MAGENTA} ;
BY SEX;
SUMBY SEX;
SUM HEIGHT WEIGHT;
Title c=red f=Arial h=7 ‘ Student Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;
Using Macros in Proc Print
%global repdate;
Proc sql;
Connect to oracle as Krishna (USER=Stanmis PASSWORD=”{sas001}QzBycDByX3Qz”
PATH=demprod);
Create table repo as
Select * from connection to Krishna
(
Select to_char(to_date(sysdate-1),’dd-Mon-yyyy’) as repdate from dual
);
Disconnect from Krishna;
Quit;
Data _null_;
Set repo;
kx=repdate;
Call symput(‘repdate’,kx);
Put kx ;
Run;
PROC IMPORT
DATAFILE=”C:\Documents and Settings\Stan\Desktop\Demographic_data.csv”
OUT=My_SAS.DEMOGRAPHIC_DATA DBMS=CSV REPLACE;
RUN;
PROC SORT DFATA= My_SAS.DEMOGRAPHIC_DATA;
BY ZONE;
RUN;
PROC FORMAT LIB=My_SAS;
VALUE $GEN ‘F’=’RED’
‘M’=’GREEN’;
RUN;
ODS PDF
FILE=”C:\Documents and Settings\Stan\Desktop\Reports\Demographic.PDF” NOTOC;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR REGION REGIONAL_MANAGER EMP_NAME INCOME SEX/style=[background=$GEN.];
ID ZONE ZONAL_HEAD;
BY ZONE ZONAL_HEAD;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 c=red f=Arial h=7 ‘Stansys Software Solutions’;
Footnote j=l c=green f=’comic sans ms’ h=7 “Generated by Mr. Krishna on &repdate”;
RUN;
ODS PDF CLOSE;
Delivering thru Mail
Filename Demo EMAIL
Sender=”MIS@stansys.co.in”
From= (“MIS@stansys.co.in”)
To= (“Charan@stansys.co.in”
“Narayan@stansys.co.in”
“Venkat@stansys.co.in”
)
Cc= (
“Ashish.Kehair@stansys.co.in”
“dharmesh.dixit@stansys.co.in”
“ketan.karkhanis@stansys.co.in”
“mihir.mehta@stansys.co.in”
“chirag.shah@stansys.co.in”
“priti.shah@stansys.co.in”
)
Bcc= (
“krishna@stansys.co.in”
“jatin.motwani@stansys.co.in”
“ankit.sharma@stansys.co.in”
)
Subject= “Demographic Report as on &repdate”
Type=”text/html”;
Ods listing close;
ODS HTML BODY=Demo style=seaside
Base=’/sas/sasebi/apache/htdocs/SBTG/’
Rs=none;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME SEX INCOME;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 c=red f=Arial h=7 ‘Stan Software Solutions ‘;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS HTML CLOSE;
Scheduling Report thru Base SAS
Write a program in SAS window like below and save in your SAS
Server or Local pc in particular location
Ex: – (E:\SAS_SCHEDULE\Demographic.sas)
———————————————————————————————-
Deliver the report into ODS location through scheduling
———————————————————————————————-
PROC IMPORT
DATAFILE=”C:\Documents and Settings\Stan\Desktop\Demographic_data.csv”
OUT=My_SAS.DEMOGRAPHIC_DATA DBMS=CSV REPLACE;
GETNAMES=YES;
RUN;
PROC SORT DFATA= My_SAS.DEMOGRAPHIC_DATA;
BY ZONE;
RUN;
PROC FORMAT;
VALUE $val ‘F’=’RED’
‘M’=’GREEN’;
RUN;
ODS PDF FILE=”C:\Documents and Settings\Stan\Desktop\Reports\Demographic.PDF” NOTOC;
PROC PRINT DATA=My_SAS.DEMOGRAPHIC_DATA NOOBS DOUBLE N
LABEL SPLIT=’*’ UNIFORM ROUND;
LABEL ZONAL_HEAD=ZONAL*MANAGER
REGIONAL_MANAGER = REGIONAL*MANAGER
EMP_NAME=EMPLOYEE*NAME;
VAR ZONE ZONAL_HEAD REGION REGIONAL_MANAGER EMP_NAME INCOME SEX/style=[background=$val.] ;
BY ZONE;
PAGEBY ZONE;
SUMBY ZONE;
SUM INCOME;
Title c=red f=Arial h=7 ‘ Employee Demographic Data’;
Title2 c=red f=Arial h=7 ‘Stan Software Solutions ‘;
Footnote j=l c=green f=’comic sans ms’ h=7 ‘Generated by Mr. Krishna ‘;
RUN;
ODS PDF CLOSE;