Help using Base SAS procedures

Diff Between Missover and Truncover

Reply
Regular Contributor
Posts: 229

Diff Between Missover and Truncover

Hi can any one help me by giving correct defonotion for missover and truncover with examples.
Super Contributor
Super Contributor
Posts: 3,174

Re: Diff Between Missover and Truncover

The SAS support website http://support.sas.com/ has a wealth of information and DOC for what you're asking. A search at the site using your keywords generates several hits. Also, a Google advanced search using the keywords below also provides many hits:

+missover +truncover site:sas.com

Also, you can add the following PUTLOG (new with SAS 9) statement to generate additional diagnostics with your DATA step to see how SAS handles the various conditions.

Scott Barry
SBBWorks, Inc.

SAS 9.2 DOC on INFILE statement:
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000146932.htm

SAS support DOC starting page (recommend bookmarking this page):
http://support.sas.com/documentation/
N/A
Posts: 0

Re: Diff Between Missover and Truncover

Hi All,
I have a Ascii file which is fixed width length. In the SAS program, I am reading the file through Infile option. I have data as below:

1201 2008-10-31 5702345678 2334
First column I should read as : 1
Second Column: 201
Third Column:
Fourth: 2008-10-31
Fifth:
Sixth:
Seventh:
Eigth:570
Ninth:2345678
tenth:
Eleventh:2334

But when I use infile option it is only reading first three columns and rest columns are empty even though some of the columns are having data.

Here is my code snippet.
data _null_;
filename temp "/mydir/filename.txt";
libname wip '$PWD/old';

data wip.basic_xtrct;
infile temp truncover;
input @1 first $1.
@2 Second $3.
@3 Third $10.
run;

Can you please help me in solving this issue.
Super Contributor
Super Contributor
Posts: 3,174

Re: Diff Between Missover and Truncover

Your INPUT statement is using the "@" pointer incorrectly, providing an offset location (column pointer position) within your data record.

Scott Barry
SBBWorks, Inc.

SAS Language Dictionary: INPUT Statement discussion (with ref to "column pointer" usage)
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000146292.htm
SAS Super FREQ
Posts: 8,743

Re: Diff Between Missover and Truncover

Hi:
As Scott suggested, the doc on column pointer control may prove useful. In addition, it helps to see the data in a "fixed pitch font", where the letter 'i' takes up the same amount of physical space on the line as the letter 'w':
[pre]
0 0 1 1 2 2 3
1...5....0....5....0....5....0...
1201 2008-10-31 5702345678 2334
abbbc2008-10-31defggghhhhhhhijjjj
xyyyz2008-10-30klmnnnooooooopqqqq
[/pre]

In the above example, I've taken your data and made it appear in a fixed font. I've added some "column info" above your data. So, you can see that position 1 (or @1) in the input line holds the value '1'. The date 2008-10-31 starts in position 6 (or @6) -- it may only be the 4th variable you read, but it starts in position 6 on the input line (each . represents a column position -- I've only shown the starting 1 and 5 in the column info).

Similarly, your value '570' starts in position 19 or @19 and your value '2334' starts in position 30 or @30.... so working with this "fixed pitch" view of your data, may help you figure out the correct INPUT statement. In order to use column pointer control effectively, ALL your data lines must line up the same way, in the same columns, when you look at them in NOTEPAD. (I made a couple of extra dummy datalines, so you could see everything "line up".)

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 306 views
  • 0 likes
  • 4 in conversation