BookmarkSubscribeRSS Feed
HamDerMathias
Calcite | Level 5

I am doing the SAS Programming 1: Essentials course. For some reason no files apear in the pg library when i make it. The files are on my computer and i can access them in SAS from the same location by "proc import". I create the library by libname pg "myfolder\EPG1V2\data"; and it goes through in the log with no errors. No data is in the library however. I hope you can help, it is super frustrating.

5 REPLIES 5
Kurt_Bremser
Super User

The fact that you can access them with PROC IMPORT means that they are not yet SAS datasets. Via a defined library, only SAS files (datasets, views, catalogs) can be accessed.

HamDerMathias
Calcite | Level 5

They are .sas .csv .xlsx .json .txt and .dat files. I followed the instructions from the lesson 2 in essentials:

 

"Follow the steps for the software you are using to assign a library named PG1 that reads the SAS tables for this course.

SAS Studio

 

  • Select New > SAS Program or press F4 to open a new program window.

  • Copy the code shown below and paste it into the Code tab. Replace FILEPATH with the full path to your EPG1V2/data folder in SAS Studio. If you don't know the path, open the Files and Folders panel, and expand EPG1V2. Right-click the data folder and select Properties. You can copy the path from the Location box.
  1. Run the code and check the log. You should see a note in the log that says the Libref PG1 was successfully assigned with information about the engine and physical name.

  2. Select the Code tab and click Save Program.

  3. For Location, select the EPG1V2 folder. Name the program libname.sas and click Save. Replace the file if it already exists.

SAS Enterprise Guide

 

  • In the Project Tree, select Autoexec to make it the active process flow. Select File > New > Program to open a new program window.

  • In the code shown below, &path is a macro variable that provides the path to a temporary location where you can store files. This macro variable was created when you set up your course files and is created each time you run the Autoexec process flow. You will learn more about macro variables later in this course. The path that this macro variable stores is the path to a temporary folder on the server. We use this temporary folder because it works in all SAS Enterprise Guide environments.

 

 

libname pg1 "&path";

 

  • Copy the LIBNAME statement into the Program window. Run the code and check the log. You should see a note that the libref PG1 refers the same physical library as Work and a note that the libref PG1 was successfully assigned.

 

  1. In the Project Tree, right click the Program icon and select Rename. Type libname.sas and press Enter.

  2. Select File > Save Project."
    "
    But the files somehow dont appear in the library. I don't know if this help to understand my problem? Or how to possibly solve it. Thanks for the quick reply 🙂

 

Kurt_Bremser
Super User

In order to see SAS datasets in a library, you have to populate the library. Importing external data into SAS is part of the Programming 1 course.

Reeza
Super User
When you ran the code you copy and pasted including the libname, were there errors in the log?

Copy the code shown below and paste it into the Code tab. Replace FILEPATH with the full path to your EPG1V2/data folder in SAS Studio. If you don't know the path, open the Files and Folders panel, and expand EPG1V2. Right-click the data folder and select Properties. You can copy the path from the Location box.
Cynthia_sas
SAS Super FREQ

Hi:

  Our e-learning course has instructions, inside the course for how to make the data. Here's what the screen looks like:

Cynthia_sas_0-1617801846991.png

   I'm confused by the instructions you pasted because they don't look like the instructions we have for SAS University Edition or for Enterprise Guide. As you can see, we have a separate set of instructions for both SAS University Edition and SAS Enterprise Guide AND all the other interface methods that a student might use.

 

  Can you explain how you're using SAS? Did you run the data creation program? Did someone revise the instructions for Programming 1? Are you taking a version of Programming 1 from a professor?

 

  Your use of "myfolders" indicates that you might be using SAS University Edition in a Virtual Machine. If so, your top node in SAS Studio when you go to Server Files and Folders should be My Folders. That means the physical path name for your class data would be:

/folders/myfolders/EPG1V2/data and that means your LIBNAME statement would be:

libname PG1 '/folders/myfolders/EPG1V2/data';

 

You can ALWAYS verify this location by following the instructions and going to the Server Files and Folders pane, expand the EPG1V2 folder under the top node and then right click on the data subfolder and choose Properties. If you followed the instructions inside our class correctly, then the Location field should show you the correct full path you need for a LIBNAME statement.

 

  The zip file we provide does come with some files already created. But most of the files that you need for the course are created by the data setup program. So you need to run that program to successfully make all the data.

 

  Remember that the SAS LIBNAME statement is meant to point to SAS proprietary files with the file extension of .sas7bdat -- so after you issue your LIBNAME statement, your PG1 library will show you ONLY the SAS files in the library. On the other hand, the Server Files and Folders pane should show you ALL the files in the class EPG1V2/data folder. For example, if you need to read one of the XLSX files, such as the np_info.xlsx file or the storm.xlsx file -- then you should find the XLSX and other files in the data subfolder AFTER you run the data creation program. Assuming that the path to your data folder is:

/folders/myfolders/EPG1V2/data then the path for PROC IMPORT would be:

datafile='/folders/myfolders/EPG1V2/data/np_info.xlsx' or

datafile='/folders/myfolders/EPG1V2/data/storm.xlsx'

 

Hope this helps,

Cynthia

 

This video shows how to make the data for the Programming 1 class using SAS University Edition in a Virtual Machine: https://www.youtube.com/watch?v=5vfd_jt8ttc

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 2288 views
  • 0 likes
  • 4 in conversation