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;
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
I have read many forums and tutorials and feel like I have tried this every way. I would love feed back
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.
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:
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:
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
Then in the CONTENTS, I see the same location as that shown in the Properties Window and as I coded in the LIBNAME statement:
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
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.
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.
Hi Reeza-
Thank you so much for your feedback. I believe I made the corrections. Still the same issue.
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;
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;
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?
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?
https://video.sas.com/detail/videos/sas-analytics-u/video/4664335810001/accessing-your-existing-data...
This video explains these concepts, probably worth watching.
Or this one, more specifically for SAS data sets:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.