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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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