- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data testing;
input Fiscal $ 1-16 Marca $ 17-36
AssetTypeSegment $ 37-60 Brand $ 61-73;
infile datalines expandtabs truncover firstobs=2;
datalines;
Fiscal Marca Segment Brand
ACCESORIOS ACCESORIOS Non-Automotive Not Defined
;
run;
For this record, I'm expecting Brand='Not Defined'
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your data elements don't start in the columns you think they do. You're just "lucky" that your strings are shorter than your field lengths so the issue only surfaces in the last column.
The bigger issue:
EXPANDTABS assumes Tab Stops every 8 characters. It doesn't look like that was the tab stop setting in the editor you've used.
Much more discussion and resolution options here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If your data has tabs then reading with fixed columns is somewhat problematic and you are likely better off to use list input.
It can take a bit of practice to "count columns" correctly when the tabs have to be expanded logically.
Since the copy and paste from the forum to my editor is likely converting tabs to spaces then I cannot duplicate your result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your data elements don't start in the columns you think they do. You're just "lucky" that your strings are shorter than your field lengths so the issue only surfaces in the last column.
The bigger issue:
EXPANDTABS assumes Tab Stops every 8 characters. It doesn't look like that was the tab stop setting in the editor you've used.
Much more discussion and resolution options here.