心有阳光 发表于 2019-10-22 14:02:19

SAS自定义格式


自定义格式

1.自定义数值字段的格式

一般数值字段:

日期类型:特殊对待

proc format;
value datefmat

low-'31dec2006'd=   
               '01jan2007'd<-high=
.='None';
run;
proc freq data=orion.employee_payroll;
   tables Employee_Term_Date;
   format Employee_Term_Date datefmat.;
   title 'Employee Status Report';
run;

2.自定义字符字段的格式:格式名称必须以$开头

proc format;
value $gender

'F'='Female'
   'M'='Male'
other='Invalid code';
value salrang

20000-<100000='Below $100,000'
   100000-500000='$100,000 or more'
.='Missing salary'
   other='Invaild salary';
run;
proc print data=orion.nonsales;
   var Employee_ID Job_Title Salary Gender;
   format Gender $gender. Salary salrang.;
   title1 'Distribution of Salary and Gender Values';
   title2 'for Non-Sales Employees';
   
run;
页: [1]
查看完整版本: SAS自定义格式