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'
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.
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.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.