Chapter Contents

Previous

Next
The FORMAT Procedure

Example 8: Writing Ranges for Character Strings


Data sets:
PROCLIB.STAFF .

This example creates a format and shows how to use ranges with character strings.


Program

libname proclib 'SAS-data-library';
options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
data train;
   set proclib.staff(keep=name idnumber);
run;
 Note about code
proc print data=train noobs;
   title 'The TRAIN Data Set without a Format';
run;
 Note about code
proc format;


 Note about code
   value $skill  'a'-<'e','A'-<'E'='Test A'
                 'e'-<'m','E'-<'M'='Test B'
                 'm'-'z~','M'-'Z~'='Test C';
run;






 Note about code
proc report data=train nowd;
   column name name=test idnumber;
   define test / display format=$skill. 'Test';
   title 'Test Assignment for Each Employee';
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.