全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2241 4
2011-07-05
想请问各位好朋友,pad  missover 和truncover这三个参数之间有什么联系,各有什么作用呢?
二维码

扫码加我 拉你入群

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

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

全部回复
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;
二维码

扫码加我 拉你入群

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

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

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.
二维码

扫码加我 拉你入群

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

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

2011-7-6 09:51:53
shenliang_111 发表于 2011-7-5 22:53
想请问各位好朋友,pad  missover 和truncover这三个参数之间有什么联系,各有什么作用呢?
pad  + missover =truncover
二维码

扫码加我 拉你入群

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

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

2011-7-6 19:35:41
4# bobguy
知道这个等式,就是具体搞不清楚,总觉得truncover和missover是相同的
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群