Prev: MISSOVER or TRUNCOVER?
Next: a question in PROC GENMOD
From: Joe Matise on 6 Oct 2009 15:52 The (only) difference is if a variable is halfway across the column that it's expected to be in. So they're effectively identical for list input. I rarely use MISSOVER, unless there's a variable that must be (precisely) six long or whatnot and should be skipped if it's under six. The specific comment from the SAS documentation: "The TRUNCOVER and MISSOVER options are similar. Both options set the remaining INPUT statement variables to missing values. The MISSOVER option, however, causes the INPUT statement to set a value to missing if the statement is unable to read an entire field because the field length that is specified in the INPUT statement is too short. The TRUNCOVER option writes whatever characters are read to the appropriate variable so that you know what the input data record contained." -Joe On Tue, Oct 6, 2009 at 2:36 PM, Sally Muller <sallymuller(a)bellsouth.net>wrote: > All, > > With the program below it appears that either MISSOVER or TRUNCOVER work > equally well. In both the "Little SAS Book" and Cody's "Learning SAS by > Example" the authors seem to imply to use MISSOVER with list input and > TRUNCOVER with formatted input. > > Is this a hard and fast rule or is it the case that you can use missover > and > truncover with either? > > Thanks much! > > Sally Muller > > > > data four_dates; > infile datalines truncover; /* missover appears to work the same */ > input @1 Subject $3. > @5 DOB mmddyy10. > @16 VisitDate mmddyy8. > @25 TwoDigit mmddyy8. > @34 LastDate date9.; > format DOB VisitDate date9. > TwoDigit LastDate mmddyy10.; > datalines; > 001 10/21/1950 05122003 08/10/65 23Dec2005 > 002 01/01/1960 11122009 09/13/02 02Jan1960 > 003 03/ 10052009 12/01/08 > 004 06/24/2000 06122007 09/11/60 24AUG2009 > run; > > proc print; > run; >
From: Mike Zdeb on 6 Oct 2009 16:03 hi ... there's a neat paper that expands on Joe's comments ... "MISSOVER, TRUNCOVER, and PAD, OH MY!! or Making Sense of the INFILE and INPUT Statements" by Randall Cates http://www.nesug.org/proceedings/nesug01/at/at1sa1.pdf that has a very good comparison of the various "OVER" options when used with LIST versus COLUMN input and a file with some short records it includes ... MISSOVER was originally created to be used in conjunction with PAD and works effectively and well in most situations. However, this can be a CPU intensive process when reading an extremely large file. TRUNCOVER was developed later than the MISSOVER and PAD options, and deals admirably with not only short lines but with short values. TRUNCOVER is more also efficient since it doesn�t require the extra "padding". in the examples ... both perform the same function with LIST input with COLUMN (or FORMATTED) input, TRUNCOVER will allow you to read partial values from short records, but MISSOVER does not conclusion ... for LIST input, one or the other for COLUMN (or FORMATTED) input, depends what you want done with short records -- Mike Zdeb U(a)Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475 > The (only) difference is if a variable is halfway across the column that > it's expected to be in. So they're effectively identical for list input. I > rarely use MISSOVER, unless there's a variable that must be (precisely) six > long or whatnot and should be skipped if it's under six. > > The specific comment from the SAS documentation: > > "The TRUNCOVER and MISSOVER options are similar. Both options set the > remaining INPUT statement variables to missing values. The MISSOVER option, > however, causes the INPUT statement to set a value to missing if the > statement is unable to read an entire field because the field length that is > specified in the INPUT statement is too short. The TRUNCOVER option writes > whatever characters are read to the appropriate variable so that you know > what the input data record contained." > > -Joe > > On Tue, Oct 6, 2009 at 2:36 PM, Sally Muller <sallymuller(a)bellsouth.net>wrote: > >> All, >> >> With the program below it appears that either MISSOVER or TRUNCOVER work >> equally well. In both the "Little SAS Book" and Cody's "Learning SAS by >> Example" the authors seem to imply to use MISSOVER with list input and >> TRUNCOVER with formatted input. >> >> Is this a hard and fast rule or is it the case that you can use missover >> and >> truncover with either? >> >> Thanks much! >> >> Sally Muller >> >> >> >> data four_dates; >> infile datalines truncover; /* missover appears to work the same */ >> input @1 Subject $3. >> @5 DOB mmddyy10. >> @16 VisitDate mmddyy8. >> @25 TwoDigit mmddyy8. >> @34 LastDate date9.; >> format DOB VisitDate date9. >> TwoDigit LastDate mmddyy10.; >> datalines; >> 001 10/21/1950 05122003 08/10/65 23Dec2005 >> 002 01/01/1960 11122009 09/13/02 02Jan1960 >> 003 03/ 10052009 12/01/08 >> 004 06/24/2000 06122007 09/11/60 24AUG2009 >> run; >> >> proc print; >> run; >> >
|
Pages: 1 Prev: MISSOVER or TRUNCOVER? Next: a question in PROC GENMOD |