楼主: shenliang_111
2048 4

[原创博文] 导入数据时的关键变量 [推广有奖]

  • 3关注
  • 12粉丝

教授

15%

还不是VIP/贵宾

-

威望
0
论坛币
26 个
通用积分
0.8674
学术水平
20 点
热心指数
26 点
信用等级
12 点
经验
17989 点
帖子
478
精华
0
在线时间
1623 小时
注册时间
2011-2-24
最后登录
2023-11-6

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
想请问各位好朋友,pad  missover 和truncover这三个参数之间有什么联系,各有什么作用呢?
二维码

扫码加我 拉你入群

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

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

关键词:导入数据 关键变量 truncover missover cover 朋友

沙发
honghejing 发表于 2011-7-6 08:47:35 |只看作者 |坛友微信交流群
MISSOVER
prevents an INPUT statement from reading a new input data record if it does not find values in the current input line for all the variables in the statement. When an INPUT statement reaches the end of the current input data record, variables without any values assigned are set to missing.
Use MISSOVER if the last field(s) may be missing and you want SAS to assign missing values to
the corresponding variable.

TRUNCOVER
overrides the default behavior of the INPUT statement when an input data record is shorter than the INPUT statement expects. By default, the INPUT statement automatically reads the next input data record. TRUNCOVER enables you to read variable-length records when some records are shorter than the INPUT statement expects. Variables without any values assigned are set to missing.

Use TRUNCOVER to assign the contents of the input buffer to a variable when the field is shorter than expected.

Example:  MISSOVER

filename mmm 'c:\sas_class\classdata\stocks_missover.txt';                                                                        
         
* No missover option, only 13 rows read into the sas data.;                                                                                                                              
data stocks;                                                                                                                     
    infile mmm;                                                                                                                    
    input ticker $  price  industry $;                                                                                             
run;                                                                                                                              
                                                                                                                                                                                                                                                                              
filename mov 'c:\sas_class\classdata\stocks_missover.txt';                                                                        
               
* With missover option, all rows are read into the sas data.;                                                                                                                        
data stocks;                                                                                                                     
    infile mov missover;                                                                                                           
    input ticker $  price  industry $;                                                                                             
run;

Example:  TRUNCOVER

* Read text file into sas dataset without truncover;                                                                                    
data temp;                                                                                                                              
     infile 'c:\sas_class\classdata\truncover_effect.txt'  ;                                                                       
     input line  $ 1-256 ;                                                                                                         
run;                                                                                                                                    
                                                                                                                                       
proc print data=temp;                                                                                                                  
run;                                                                                                                                    
                                                                                                                                       
* Read text file into sas dataset with truncover;                                                                                                                                                                                                                           
data temp;                                                                                                                              
     infile 'c:\sas_class\classdata\truncover_effect.txt' truncover;                                                               
     input line  $ 1-256 ;                                                                                                         
run;                                                                                                                                    
                                                                                                                                       
proc print data=temp; run;

使用道具

藤椅
honghejing 发表于 2011-7-6 08:48:54 |只看作者 |坛友微信交流群
The PAD option specifies that SAS pad variable length records with blanks. The
MISSOVER option prevents SAS from reading past the end of the line when reading free
formatted data. The DLM= option specifies the comma as the delimiter; however,
consecutive delimiters are treated as one by default. The DSD option correctly reads the
data with commas as delimiters and two consecutive commas indicating a missing value
like those in this raw data file.
You can learn about
• the PAD option in Reading Raw Data in Fixed Fields
• the MISSOVER option in Creating Multiple Observations from a Single
Record
• the DLM= option and the DSD option in Reading Free-Format Data.
已有 1 人评分论坛币 收起 理由
liuzhenzhu + 50 热心帮助其他会员

总评分: 论坛币 + 50   查看全部评分

使用道具

板凳
bobguy 发表于 2011-7-6 09:51:53 |只看作者 |坛友微信交流群
shenliang_111 发表于 2011-7-5 22:53
想请问各位好朋友,pad  missover 和truncover这三个参数之间有什么联系,各有什么作用呢?
pad  + missover =truncover

使用道具

报纸
shenliang_111 发表于 2011-7-6 19:35:41 |只看作者 |坛友微信交流群
4# bobguy
知道这个等式,就是具体搞不清楚,总觉得truncover和missover是相同的

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-30 23:13