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.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1338 views
  • 0 likes
  • 3 in conversation