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