Desktop productivity for business analysts and programmers

Dataset name starting with a number

Frequent Contributor
Posts: 79

Dataset name starting with a number

Hi, this may sound strange as a strange thing to want to do, but when I use Import Data from the EG (6.1) menu, I can created an import step for a file (eg. a CSV file) that as a number as the first 'character' in the name, for instance 2016_07_26_mycsv.csv. This gets imported allright and a SAS dataset is created in the work folder with the same name, also including the first 'character', here a '2'.  But this dataset cannot be referenced by its name, at least not in any way I know of. So that is my question: How do I handle this?


Sometimes I have succesfully renamed the dataset manually in the explorer window, but strangely enough this not always allowed from EG61. I cannot see the pattern in when it is allowed and not and would like to have a more stable way of handling this.


Thanks in advance


Poul Ravn Sørensen

Super User
Posts: 23,977

Re: Dataset name starting with a number

Don't allow SAS to create names with numbers at the start. 

The first one has the standard SAS restrictions, the second option which seems to be the default in EG allows the naming convention you see. 

Options validvarname = v7;

Options validvarname = Any;

You can reference the dataset using a name literal, quotes and a N afterwards. 





Super User
Super User
Posts: 9,813

Re: Dataset name starting with a number

@Reeza has given you a good explanation.  I would just add that this is another good example of why not to keep "data" in table names/column names.  Table names and variable names are for programming purpose - they are not to store data in.  It makes your life much harder if you are trying to work out what datasetnames are, what column names are.  Have a read where the "data" in the filename is stored to the dataset, and have one dataset for all the data.


Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation