BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
AmrAd
Obsidian | Level 7

i am trying to import bulk of files and create one dataset having all these files ,i am facing a problem that variable name is greater than 32 character and sas is not accepting this accordingly sas renames the header to serial as Name 1 name 2 .etc

i need to capture original header name to be able to append all the tables in one table 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

As long as you use Excel files, and have names in there which exceed the limits of SAS, you will have problems.

  • either use valid names (up to 32 characters, containing only letters, digits or underlines, do not start with a digit) in the spreadsheets
  • or save the files as text files (csv), which you can read with a DATA step you write, giving you full control over variable names and attributes (discard the header line with FIRSTOBS=2 in the INFILE statement)

The second option is preferred for repeatable, consistent results.

View solution in original post

5 REPLIES 5
JosvanderVelden
SAS Super FREQ
What file types will you import? ex. csv, xls, xlsx, delimited... Which encoding do these files have? ex. ANSI, UTF8 ... The header with varnames is a single line/row with less then 32676 characters?
AmrAd
Obsidian | Level 7

Hi Josvander

i am trying to import XLSX file with UTF8 encoding

 

Kurt_Bremser
Super User

As long as you use Excel files, and have names in there which exceed the limits of SAS, you will have problems.

  • either use valid names (up to 32 characters, containing only letters, digits or underlines, do not start with a digit) in the spreadsheets
  • or save the files as text files (csv), which you can read with a DATA step you write, giving you full control over variable names and attributes (discard the header line with FIRSTOBS=2 in the INFILE statement)

The second option is preferred for repeatable, consistent results.

AmrAd
Obsidian | Level 7
The header with varnames is a single line/row with less then 32676 characters?

yes

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 610 views
  • 3 likes
  • 3 in conversation