BookmarkSubscribeRSS Feed
11 REPLIES 11
PaigeMiller
Diamond | Level 26
ERROR: Libref SP4R is not assigned.

You have to create libref SP4R via a LIBNAME statement that points to the exact folder where the file SP4R.RANDOM is located. You haven't done that.

 

Add the proper LIBNAME statement into your code.

--
Paige Miller
kamalhossain22
Calcite | Level 5

kamalhossain22_0-1640960472895.png

It shows me above when I tried to open the SAS file on SAS studio. How to assign the libref SP4R? please help me ...

PaigeMiller
Diamond | Level 26

You can't use macro variable &PATH until you define this macro variable. But you don't need a macro variable here. Right-click on baseball.csv and select Properties, that will tell you the folder path of the actual file, that's what you need there. Something like (I'm making this up because I don't know the exact folder name)

 

datafile="home/paige.miller3/baseball.csv"

 

You can't use libref SP4R until you define it in a LIBNAME statement. Something like this, where you put in double-quotes the exact name of the folder where the files are stored (which I don't know, I'm making this up, but you should know):

 

libname sp4r "/home/paige.miller3/datasets";

 

--
Paige Miller
kamalhossain22
Calcite | Level 5

kamalhossain22_0-1640961665562.png

Even after locating appropriate location of the file and use the code you mentioned, thesults shows me as in the picture....How can I solve the problem?

PaigeMiller
Diamond | Level 26

Let's take a step back and understand what LIBNAME does. It associates a FOLDER (not a .sas file) with a name (called a libref), so that you can access SAS data sets that are (or will be) stored in that folder. SAS data sets are not .sas files, these are different things.

 

So, if you have SAS data sets in a folder, you would use a LIBNAME statement. You cannot use a LIBNAME statement to point to a .SAS file.

 

What are you trying to do? Are you trying to open a .sas file? Are you trying to read a SAS data set? Are you trying to allocate a name to a folder? All of the above? None of the above?

--
Paige Miller
kamalhossain22
Calcite | Level 5

Thank you, sir, I am trying to open the SAS data on SAS studio. All the data in xls and CSV format were opened but the SAS data in the folder is not opening.

PaigeMiller
Diamond | Level 26

I think you should really go back to your teacher or professor or local SAS expert and have them explain details of LIBNAME and SAS data sets and .csv files and so on. These are such basic fundamentally important concepts that you need to have a good grasp of them, and talking to your local SAS expert or professor seems to be the best way to achieve this.

 

I also can't seem to grasp what you are saying here:

 

Thank you, sir, I am trying to open the SAS data on SAS studio. All the data in xls and CSV format were opened but the SAS data in the folder is not opening.

"trying to open the SAS data" and "all the data in xls and csv" don't go together, because .xls and .csv are NOT SAS data sets. They are simply files.

 

Be specific. What file or SAS data set are you trying to open? Give me the exact name of the file or SAS data set.

--
Paige Miller
PaigeMiller
Diamond | Level 26

These are not SAS data files. They are SAS programs. You do not write code to open SAS programs.

 

You can open the SAS program by right-clicking on it ... and then the next step should be obvious.

--
Paige Miller
kamalhossain22
Calcite | Level 5

Thank you sir

Kurt_Bremser
Super User

@kamalhossain22 wrote:

kamalhossain22_0-1640961665562.png

Even after locating appropriate location of the file and use the code you mentioned, thesults shows me as in the picture....How can I solve the problem?


A .sas file is a program file in text format, intended to be loaded into the editor and executed from there. You cannot use it as a library.

On a system with a hierarchical file system (like Windows or UNIX), the physical location of a SAS library has to be a directory.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 11 replies
  • 3500 views
  • 1 like
  • 3 in conversation