BookmarkSubscribeRSS Feed
linedpaper
Fluorite | Level 6

I am doing the SAS Programming 1: Essentials / Lessons / Lesson 2: Accessing Data (activity). 

Activity instructions:

  1. Open a new program window. (done)
  2. Write a LIBNAME statement to create a library named NP that reads np_info.xlsx in the course data as follows:

         SAS Studio: Specify the full path to your EPG1V2/data folder and the             complete file name. (done)

  1. Run the LIBNAME statement. (done)
  2. Navigate to your list of libraries and open the NP library. How many tables are there in the NP library? (here is the problem)

Everything seems to work except there are no tables (supposed to have Parks, Species, and Visits) in the NP library.  I have an NP library in the libraries section but when I try to expand to see the tables there is nothing to expand.  What have I done wrong?

Solutions I’ve tried:

  1. Checked my answer was correct according to the activity (libname np xlsx "FILEPATH/np_info.xlsx";)
  2. I looked under Files (Home) -> Data -> and there IS an excel file called np_info.xlsx

Thank you so much for your help!

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi,

When I run the activity to point to the np_info.xlsx file, I need an XLSX Libname statement to point to the workbook.In the problem, we use the word FILPATH to indicate where you have to substitute your location for the XLSX file:

Cynthia_sas_0-1673996870145.png

So just using FILEPATH should result in errors in your SAS Log or in Physical File Not Found messages.

When I code the LIBNAME statement for NP_INFO.XLSX, my libname statement looks like this:

libname np xlsx "/home/u12345678/EPG1V2/data/np_info.xlsx";

 

Note that on my system, my Files (Home) location is /home/u12345678, but YOUR user folder location will be different on the SAS OnDemand server. Or, you could be using our Virtual Lab, in which case, the XLSX folder path will be different.

  The never-fail method for finding out the correct FILEPATH you need to use for YOUR libname statement is to go to Files (Home) and expand, that top node, then expand the EPG1V2 main class folder, then expand the data subfolder. If you right click on the data subfolder, you can choose Properties and then in the Location field of the Properties window, you should see the correct FILEPATH for your data subfolder. That is the path you need to substitute any time you see the FILEPATH placeholder in any of our instructions or starter code.

 

  Also, remember that you do NOT CLEAR the LIBNAME statement until after you go to the Libraries panel to look at the contents. The other way you can see the names of the individual sheets in the XLSX file is to use PROC CONTENTS like this:

libname np xlsx "/home/u12345678/EPG1V2/data/np_info.xlsx";

proc contents data=np._all_ nods;

run;

proc contents data=np.parks;

run;

 

  And then, assuming you have the path correct, you should see the individual sheet names, if there are any, in the CONTENTS output.

Cynthia_sas_1-1673997516787.png

I hope this helps you find the correct FILEPATH to your data. Since you can see the np_info.xlsx file under your data subfolder, you should only need to get the XLSX LIBNAME statement correctly specified to get this activity down.

Cynthia

 

:

linedpaper
Fluorite | Level 6
Thank you so much!!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 428 views
  • 3 likes
  • 2 in conversation