BookmarkSubscribeRSS Feed
Calcite | Level 5 PQK
Calcite | Level 5
Dear Forum,

I can accurately read CSV file data using EG4.3 and IMPORT (File > Import Data) even though the file contains a first line of column names with embedded blanks, dashes (-), parentheses and periods.

However, I am learning how to program in SAS and would like to replace this step with code. I can create working code with DATA, INFILE, INPUT statements and so forth using standard column names.

The problem is how to get SAS to read column names when the column names include spaces, parentheses etc.

If I borrow the 'column name'n convention EG4.3 generates in the INPUT statement from the IMPORT Wizard code, I either get a tableview with ??? in each cell (in the case of EG4.3) or I get the error "The name is not a valid SAS name." if I run my code in SAS9.2 using the 'column name'n convention.

Even if I cut and paste the entire EG4.3 code from the IMPORT step into a seperate code program and run it in a seperate project, I still get a tableview with ??? in each cell.

What I'm I doing wrong?
Community Manager
You might need to set this option:

options validvarname=any;

EG sets it by default, but if you are running in SAS Display Manager or batch, it's not the default setting.

SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.
Calcite | Level 5 PQK
Calcite | Level 5

Thank you for your reply to my post.

It turned out that the problem with ??? in each cell of my tableview was due to the length and format of various numeric/character variables. After conducting a careful trial and error analysis of each variable I was able to narrow down the issue to a view problem variables.

Your suggestion in regards to changing the VALIDVARNAME option worked perfectly for base SAS (9.2). Although the default in EG4.3 is already set to VALIDVARNAME=ANY, the option in Base SAS was set to V7. After changing this option (and my changes to the length and format mentioned above), both Base SAS and EG4.3 were able to produce the dataset from code.

Best Regards,


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!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 in conversation