BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
franriv
Obsidian | Level 7
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;

 2019-09-25 09_13_22-franriv_ziris_0925xC - SAS Enterprise Guide.png

 

For this record, I'm expecting Brand='Not Defined'

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@franriv 

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.

View solution in original post

2 REPLIES 2
ballardw
Super User

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.

Patrick
Opal | Level 21

@franriv 

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 515 views
  • 2 likes
  • 3 in conversation