楼主: Rock2000
2168 6

crakman版主:在input语句后的evaluation参数是什么意思? [推广有奖]

  • 1关注
  • 24粉丝

已卖:6892份资源

学术权威

23%

还不是VIP/贵宾

-

威望
1
论坛币
104790 个
通用积分
51.9656
学术水平
55 点
热心指数
74 点
信用等级
48 点
经验
23510 点
帖子
520
精华
0
在线时间
10924 小时
注册时间
2004-5-27
最后登录
2025-11-12

楼主
Rock2000 发表于 2013-10-20 21:23:09 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
crackman版主http://crackman.net/?p=575的“跟crackman读SAS程序(93)–invalue的一个应用(将字符型输入数据转变成数值型数据)”,在程序的input语句后有evaluation.,这是干什么用的?解释如何?版主能明示吗?谢谢。
哈哈,连crackman版主的名都写错,改正了。
  1. /*
  2. 跟crackman读SAS程序(93)–invalue的一个应用(将字符型输入数据转变成数值型数据)
  3. */
  4. options nodate pageno=1 linesize=70 pagesize=50;
  5. proc format library=work;
  6.      invalue evaluation 'O'=4
  7.                         'S'=3
  8.                         'E'=2
  9.                         'C'=1
  10.                         'N'=0
  11.                         ;
  12. run;

  13. data points;
  14.    input EmployeeId $ (Q1-Q4) (evaluation.,+1);
  15.    TotalPoints=sum(of q1-q4);
  16.    datalines;
  17. 2355 S O O S
  18. 5889 2 2 2 2
  19. 3878 C E E E
  20. 4409 0 1 1 1
  21. 3985 3 3 3 2
  22. 0740 S E E S
  23. 2398 E E C C
  24. 5162 C C C E
  25. 4421 3 2 2 2
  26. 7385 C C C N
  27. ;
  28. proc print data=points noobs;
  29.      title 'The POINTS Data Set';
  30. run;
复制代码


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Evaluation Valuation put语句 是什么意思 Input library 干什么 程序 如何

已有 1 人评分经验 收起 理由
crackman + 100 标题写错了

总评分: 经验 + 100   查看全部评分

沙发
mingfeng07 学生认证  发表于 2013-10-20 21:33:37
这个是变量的格式,指代前面的format过程中的变量格式
欢迎扫一扫我头像关注, 不定期分享SAS技术知识。

藤椅
Rock2000 发表于 2013-10-20 21:47:05
mingfeng07 发表于 2013-10-20 21:33
这个是变量的格式,指代前面的format过程中的变量格式
变量格式?evaluation是指什么格式啊?

板凳
Rock2000 发表于 2013-10-20 22:37:19
crackman 发表于 2013-10-20 22:23
变量格式是可以通过PROC FORMAT来自定义
不能与SAS默认的变量格式混淆
就是说用PROC FORMAT自定义输入格式后,一定要用evaluation了?

报纸
mingfeng07 学生认证  发表于 2013-10-20 23:20:56
Rock2000 发表于 2013-10-20 21:47
变量格式?evaluation是指什么格式啊?
建议你看一下format语句的用法这一节
欢迎扫一扫我头像关注, 不定期分享SAS技术知识。

地板
Rock2000 发表于 2013-10-21 09:09:19
mingfeng07 发表于 2013-10-20 23:20
建议你看一下format语句的用法这一节
SAS help的解释如下,看来用了format过程转换字符到数值,在有字符及数值混合的数据,是必须要用evaluation的,谢谢。
  1. Program Description
  2. This program converts quarterly employee evaluation grades, which are alphabetic, into numeric values so that reports can be generated that sum the grades up as points.
  3. Set up two SAS library references, one named PROCLIB and the other named LIBRARY.
  4. libname proclib 'SAS-library-1';
  5. libname library 'SAS-library-2';
  6. Store the Evaluation. informat in the catalog LIBRARY.FORMATS.
  7. proc format library=library;
  8. Create the numeric informat Evaluation. The INVALUE statement converts the specified values. The letters O (Outstanding), S (Superior), E (Excellent), C (Commendable), and N (None) correspond to the numbers 4, 3, 2, 1, and 0, respectively.
  9.    invalue evaluation 'O'=4
  10.                       'S'=3
  11.                       'E'=2
  12.                       'C'=1
  13.                       'N'=0;
  14. run;
  15. Create the PROCLIB.POINTS data set. The instream data, which immediately follows the DATALINES statement, contains a unique identification number (EmployeeId) and bonus evaluations for each employee for each quarter of the year (Q1–Q4). Some of the bonus evaluation values that are listed in the data lines are numbers; others are character values. Where character values are listed in the data lines, the Evaluation. informat converts the value O to 4, the value S to 3, and so on. The raw data values 0 through 4 are read as themselves because they are not referenced in the definition of the informat. Converting the letter values to numbers makes it possible to calculate the total number of bonus points for each employee for the year. TotalPoints is the total number of bonus points.
  16. data proclib.points;
  17.    input EmployeeId $ (Q1-Q4) (evaluation.,+1);
  18.    TotalPoints=sum(of q1-q4);
  19.    datalines;
  20. 2355 S O O S
  21. 5889 2 2 2 2
  22. 3878 C E E E
  23. 4409 0 1 1 1
  24. 3985 3 3 3 2
  25. 0740 S E E S
  26. 2398 E E C C
  27. 5162 C C C E
  28. 4421 3 2 2 2
  29. 7385 C C C N
  30. ;
  31. Print the PROCLIB.POINTS data set. The NOOBS option suppresses the printing of observation numbers.
  32. proc print data=proclib.points noobs;
  33. Specify the title.
  34.    title 'The PROCLIB.POINTS Data Set';
  35. run;
复制代码

看来

7
_i_ 发表于 2013-10-21 10:13:00
通过format,把数据读成了数值型,里面O与0注意一下

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-3 06:15