BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AprilR
Calcite | Level 5
I have specified the Libref pathway (I believe). But can not do any proc commands. It says Error: no data set open to look up variables.

When I attempted to assign the libref it says (in blue)
Note: libref MIDTERM was successfully assigned as follows:
engine: V9
Physical name: /folders/myfolders
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

The libname is middata
The data set name is HERSTrialData
The extension of a SAS data set is sas7bdat, similar to XLSX for an excel file.

So you reference your data as:

proc means data = middata.HERSTrialData ;

 


@AprilR wrote:

Ok. I apologize for using attachments. In a previous post someone said they did know what I was seeing, so this was the only way I could show that. I put the data set name in the code. Still errors. Code:

 

libname middata '/folders/myfolders/';

 

proc means data= HERSTrialData.sas7bdat;
var tchol Age TG HT BMI Nonwhite Diabetes Statins Exercise Smoking SBP;
run;


 

View solution in original post

16 REPLIES 16
Reeza
Super User

You're likely not referencing things correctly. You have the lib name set up correctly, did you put any data in there? What command did you try to run that didn't work? Are you using Tasks or Code? If code, show the code and log. If tasks, show a screenshot of your set up and the error note. 

 


@AprilR wrote:
I have specified the Libref pathway (I believe). But can not do any proc commands. It says Error: no data set open to look up variables.

When I attempted to assign the libref it says (in blue)
Note: libref MIDTERM was successfully assigned as follows:
engine: V9
Physical name: /folders/myfolders

 

 

AprilR
Calcite | Level 5

I have read many forums and tutorials and feel like I have tried this every way. I would love feed back

 

Kurt_Bremser
Super User

Do NOT post logs, codes and example data in pictures, especially not ones taken with your cellphone. Do a copy/paste into a window opened with the {i} button.

Post both the log of the step that creates your dataset as well as the one that tries to use it.

If you need to show something that is not text or that can't be copied as such, use the computer's screenshot tools, not external devices. As it is, your log is un-readable.

Cynthia_sas
SAS Super FREQ

Hi:

  If you are using SAS University Edition, that implies that you are also using SAS Studio. The first question is: Can you see your data in a folder in the Files and Folders pane?

 

  For example, in my University Edition, with SAS Studio, in my shared folders location, I have a folder called all_sas_data, as shown below:

_1_check_files_folders_studio.png

You can see that I have several SAS datasetss visible in this folder under the /folders/myfolders location, which is visible under the Server Files and Folders pane.

 

  If I right click on the all_SAS_data folder name and then select Properties, this is what I see:

_2_use_location_from_proprties.png

As you can see, the location is shown in this window and I can copy from this window to make a LIBNAME statement like this:

 

libname mylib '/folders/myfolders/all_SAS_data';

 

proc contents data=mylib._all_;

run;

 

After I submit this code, I see the LIBNAME was successful in the LOG

_3_libname_points_to_location.png

 

Then in the CONTENTS, I see the same location as that shown in the Properties Window and as I coded in the LIBNAME statement:

_4_see_same_files.png

 

  So the first thing you have to do is tell us whether you SEE your data in your FILES and FOLDERS pane in SAS Studio. If you do, then you should only need to find the Properties Window to get the correct path for your LIBNAME statement.

 

  Hope this helps.

 

Cynthia

AprilR
Calcite | Level 5

Hi Cynthia-

This was very helpful. I do have a lib name set up. But am still unable to use proc commands. I came back to this today. Here is what the errors are saying. 

Reeza
Super User

You haven't referenced your data set correctly and/or your code is incorrect. I suggest trying with the Tasks first so you can see the code you need or take the course. 

 

proc means data=sashelp.class;
class sex;
var age weight height;
run;

Try running the following code and see if it works. Note the 'data = DataSetName ' portion which tells SAS which input data set to use. You're missing at least that portion.

 


@AprilR wrote:

Hi Cynthia-

This was very helpful. I do have a lib name set up. But am still unable to use proc commands. I came back to this today. Here is what the errors are saying. 


 

AprilR
Calcite | Level 5

Hi Reeza-

 

Thank you so much for your feedback. I believe I made the corrections. Still the same issue. 

Reeza
Super User
No, your library is called middata, not your data set name. You've never shown what your data set name is. Please do not post your code as an attachment, post it directly into the forum, copy and paste is faster and easier as well.
AprilR
Calcite | Level 5

Ok. I apologize for using attachments. In a previous post someone said they did know what I was seeing, so this was the only way I could show that. I put the data set name in the code. Still errors. Code:

 

libname middata '/folders/myfolders/';

 

proc means data= HERSTrialData.sas7bdat;
var tchol Age TG HT BMI Nonwhite Diabetes Statins Exercise Smoking SBP;
run;

Reeza
Super User

The libname is middata
The data set name is HERSTrialData
The extension of a SAS data set is sas7bdat, similar to XLSX for an excel file.

So you reference your data as:

proc means data = middata.HERSTrialData ;

 


@AprilR wrote:

Ok. I apologize for using attachments. In a previous post someone said they did know what I was seeing, so this was the only way I could show that. I put the data set name in the code. Still errors. Code:

 

libname middata '/folders/myfolders/';

 

proc means data= HERSTrialData.sas7bdat;
var tchol Age TG HT BMI Nonwhite Diabetes Statins Exercise Smoking SBP;
run;


 

AprilR
Calcite | Level 5

Thank you so much! That was my issue. I have just switched from SPSS to SAS and feel like I will never understand how to make these commands work. 

 

This is slightly off topic, but i just want to verify that  I need to put:

 

libname middata '/folders/myfolders/';

 

 

at the top of every code when I run every proc command?

Reeza
Super User

No, only if you're accessing data that you've previously saved in a library. Watch the videos for the more detailed explanations of how it works.

 


@AprilR wrote:

Thank you so much! That was my issue. I have just switched from SPSS to SAS and feel like I will never understand how to make these commands work. 

 

This is slightly off topic, but i just want to verify that  I need to put:

 

libname middata '/folders/myfolders/';

 

 

at the top of every code when I run every proc command?


 

Reeza
Super User
You reference a data set as libname.dataSetName

ie sashelp.class like in my previous post.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 16 replies
  • 17319 views
  • 3 likes
  • 5 in conversation