Help using Base SAS procedures

Exporting dataset with mixed column names (character & numeric)

Reply
Contributor
Posts: 53

Exporting dataset with mixed column names (character & numeric)

I'm getting the following error when trying to create a .csv file from a dataset with character and numeric column names (name, 2008,2009). Is there any way around this, other than exporting to .xls?



NOTE: SCL source line.
52 format 2008 best12. ;
____ _______
22 201
NOTE: SCL source line.
53 format 2009 best12. ;
____ _______
22 201
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, DEFAULT, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.

ERROR 201-322: The option is not recognized and will be ignored.
Contributor
Posts: 53

Re: Exporting dataset with mixed column names (character & numeric)

Another note, when I export using the export wizard built into SAS the file will export perfectly. It's when I'm trying to export via code is where my process fails out. Unfortunately, there is no preview within EG that will allow me to see the code generated when using the export wizard.
Trusted Advisor
Posts: 2,113

Re: Exporting dataset with mixed column names (character & numeric)

EGuide, by default, uses the OPTION VALIDVARNAME=ANY. If you use that variable in a procedure that does surface the code, you will see that the variable name is referenced as "2008"n . You also need to reference non-standard names that way. See the SAS/Base manual for the section on reverencing variable names.
Ask a Question
Discussion stats
  • 2 replies
  • 108 views
  • 0 likes
  • 2 in conversation