BookmarkSubscribeRSS Feed
LauriB
Fluorite | Level 6

I get the error message: ERROR 211-185: Invalid data set name. I have tried a number of things and can't figure out why I am getting this error. Here is my code:

 

libname student 'C:\Users\lbyer\Documents\Byerley\Water\RE_ Water with Diet';     *folder where Water file is saved;

 

data water;

  set student.diet4v2018waterOct2023.csv;

  by FoodCode;

  run;

 

Any help is appreciated. Thanks.

3 REPLIES 3
Tom
Super User Tom
Super User

A dataset name cannot have a period in it.

Do you actually have a .sas7bdat file?  If so what is its name?

If not then what kind of file do you have?  Do you have a CSV file?  That is a TEXT file.  You will have to run a DATA STEP to read the TEXT file to make a SAS dataset.

LauriB
Fluorite | Level 6
Thanks so much for the help. I got it solved.
Patrick
Opal | Level 21

Your source data is an external .csv file. A libname is for access to (SAS) tables, a filename is for access to external files, a set statement gets used to read a table (and not a file like in your code).

 

What you need to do is first to read your external file into a SAS table that you then can use in a SAS datastep or SAS Proc.

Below SAS docu example should show you the way: Example 4: Importing a Comma-Delimited File with a CSV Extension

 

If you need full control over how external data gets mapped into a SAS table then use a SAS datastep/infile, input instead of Proc Import.

Proc Import for a text file/.csv will actually also generate such data step code which it writes to the SAS log. This should give you some guidance how such code looks like.