楼主: slimdell
3712 2

DD's SAS note 04Sep2012 [推广有奖]

  • 0关注
  • 19粉丝

已卖:2049份资源

副教授

76%

还不是VIP/贵宾

-

TA的文库  其他...

移动医疗

大数据与可视化

医药行业分析

威望
0
论坛币
19053 个
通用积分
620.8039
学术水平
47 点
热心指数
58 点
信用等级
42 点
经验
7016 点
帖子
580
精华
0
在线时间
1266 小时
注册时间
2012-8-10
最后登录
2021-4-25

楼主
slimdell 发表于 2012-9-4 14:30:01 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
1.在读Ron Cody的 Cody's Data Cleaning Techniques Using SAS,有蛮多可以学习的地方。
做了这么多年的数据管理,对于data cleaning的概念其实没有一个比较明确系统的认识
What is data cleaning? In this book, we define data cleaning to include:
• Making sure that the raw data values were accurately entered into a computer readable
file.
• Checking that character variables contain only valid values.
• Checking that numeric values are within predetermined ranges.
• Checking if there are missing values for variables where complete data is necessary.
• Checking for and eliminating duplicate data entries.
• Checking for uniqueness of certain values, such as patient IDs.
• Checking for invalid date values.
• Checking that an ID number is present in each of "n" files.
• Verifying that more complex multi-file rules have been followed.

2. 用PROC FREQ 和_CHARACTER_列出char型变量
  1. title "Frequency Counts for Selected Character Variables";
  2. proc freq data=clean.patients(drop=Patno);
  3. tables _character_ / nocum nopercent;
  4. run;
复制代码
用DATA _NULL_ step来甄别无效char值
  1. title "Listing of invalid patient numbers and data values";
  2. data _null_;
  3. set clean.patients;
  4. file print; ***send output to the output window;
  5. ***check Gender;
  6. if Gender not in ('F' 'M' ' ') then put Patno= Gender=;
  7. ***check Dx;
  8. if verify(trim(Dx),'0123456789') and not missing(Dx)
  9. then put Patno= Dx=;
  10. /***********************************************
  11. SAS 9 alternative:
  12. if notdigit(trim(Dx)) and not missing(Dx)
  13. then put Patno= Dx=;
  14. ************************************************/
  15. ***check AE;
  16. if AE not in ('0' '1' ' ') then put Patno= AE=;
  17. run;
复制代码

3. SAS output显示的问题解决
用的英文版9.2,output显示会出现傻傻傻的乱码字符表格线,更改SASV9.CFG可以解决
找到对应语言版本的cfg文件,记事本类工具打开,修改如下部分,红色用/**/注释起来,蓝色去掉注释
/* This is the OEM character set                                */
/* -FORMCHAR "衬诼棵糯懒?=|-/\<>*" */
/* This is the ANSI character set (for SAS Monospace font and ANSI Sasfont) */
-FORMCHAR "們剠唶垑妺?=|-/\<>*"
/* This is the ANSI character set                               */
/* -FORMCHAR "|----|+|---+=|-/\<>*" */

4. 第一次碰到类似下面的error message:
NOTE 49-169: The meaning of an identifier after a quoted string may change in a future SAS
             release.  Inserting white space between a quoted string and the succeeding
             identifier is recommended.
NOTE 49-169: 加引号的字符串后的标识符的含义可能在将来的 SAS 版本中更改。建议在加引号的字符串和标识符之间插入空格。
通过自学检查code解决
二维码

扫码加我 拉你入群

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

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

关键词:note not Alternative recommended Techniques character computer contain include values

知乎专栏/微信公号同名:煮酒烹茶读书

沙发
Wingtree 发表于 2014-8-5 10:02:15
你好,
      请问您提到的以下错误怎么更改?
NOTE 49-169: 加引号的字符串后的标识符的含义可能在将来的 SAS 版本中更改。建议在加引号的字符串和标识符之间插入空格。

藤椅
eviljimi76 发表于 2017-8-9 14:10:51
碰到此类NOTE,建议使用%STR()等quote function进行掩蔽

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

本版微信群
jg-xs1
拉您进交流群
GMT+8, 2026-1-11 10:44