BookmarkSubscribeRSS Feed
PoulRavn
Obsidian | Level 7

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

Regards

Poul Ravn Sørensen

2 REPLIES 2
Reeza
Super User

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. 

 

'2016_07_26mycsv.csv'n 

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 8841 views
  • 1 like
  • 3 in conversation