使用量程系统对SAS中的血栓进行分类 [英] Categorizing variabels in SAS using a range system
问题描述
至少$ 20,000但低于$ 100,000 -
至少$ 100,000至$ 500,000 - > $ 100,000
遗失 - 缺少工资
其他任何值 - 无效的薪水
我已经做了与性别类似的事情。我只想使用proc print和format命令来显示工资和性别。
DATA Work.nonsales2;
SET Work.nonsales;
RUN;
PROC FORMAT;
VALUE $性别
'M'='男性'
'F'='女性'
'O'='其他'
other ='无效的代码' ;
PROC FORMAT;
VALUE salrange
'至少$ 20,000但小于$ 100,000'=< $ 100,000
other ='无效的代码';
PROC PRINT;
标题'薪水和性别';
title2'非销售员工';
格式性别$性别。
RUN;
Proc格式是正确的方法,您需要一个数字格式:
proc格式;
值salfmt
20000 - < 100000 =至少$ 20,000但不到$ 100,000
100000 - 500000 =100,000 +
。 ='缺少'
other ='其他';
然后在您的打印中应用格式,类似于您为性别所做的操作。 b
$ b
format salary salfmt .;
这应该有助于您开始。
I have the numeric values of salaries of different employee's. I want to break the ranges up into categories. However I do not want a new column rather, I want to just format the existing salary column into this range method:
At least $20,000 but less than $100,000 -
At least $100,000 and up to $500,000 - >$100,000
Missing - Missing salary
Any other value - Invalid salary
I've done something similar with gender. I just want to use the proc print and format command to show salary and gender.
DATA Work.nonsales2;
SET Work.nonsales;
RUN;
PROC FORMAT;
VALUE $Gender
'M'='Male'
'F'='Female'
'O'='Other'
other='Invalid Code';
PROC FORMAT;
VALUE salrange
'At least $20,000 but less than $100,000 '=<$100,000
other='Invalid Code';
PROC PRINT;
title 'Salary and Gender';
title2 'for Non-Sales Employees';
format gender $gender.;
RUN;
Proc Format is the correct method and you need a numeric format:
proc format;
value salfmt
20000 - <100000 = "At least $20,000 but less than $100,000"
100000 - 500000 = "100,000 +"
. = 'Missing'
other = 'Other';
Then in your print apply the format, similar to what you did for gender.
format salary salfmt.;
This should help get you started.
这篇关于使用量程系统对SAS中的血栓进行分类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!