Chapter Contents

Previous

Next
The FORMAT Procedure

Example 5: Creating a Format from a Data Set


Procedure features:
PROC FORMAT statement option:
CNTLIN=
Input Control Data Set
Data sets:
PROCLIB.POINTS .

This example shows how to create a format from a SAS data set.

Tasks include


Program

libname proclib 'SAS-data-library-1';
libname library 'SAS-data-library-2';
options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
data proclib.scale;
   input begin $ 1-2 end $ 5-8 amount $ 10-12;
   datalines;
0   3    0%
4   6    3%
7   8    6%
9   10   8%
11  16   10%
;
 Note about code
data ctrl(rename=(begin=start amount=label));
   set proclib.scale end=last;





 Note about code
   retain fmtname 'ptsfrmt' type 'n';



 Note about code
   if last then hlo='h';
   else hlo=' ';
run;





 Note about code
   proc print data=ctrl noobs;
      title 'The CTRL Data Set';
   run;
 Note about code
   proc format library=library cntlin=ctrl;
   run;





 Note about code
proc report data=proclib.points nowd colwidth=12;
   column employeeid totalpoints totalpoints=Pctage;
   define pctage / format=ptsfrmt10. 'Percentage';
   title 'The Percentage of Salary For Calculating Bonus';
run;



Output
PROC PRINT output [HTML Output]
 [Listing Output]
PROC REPORT output [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.