BookmarkSubscribeRSS Feed
CP3X
Calcite | Level 5

Hi.

 

I am trying to work through some very basic things in SAS using an online course that SAS offers (SAS Programming Essentials 1).

 

Do you see anything obviously wrong with this procedure?

 

proc contents data="&path/storm_summary.sas7dbat";

run;

 

 

 

These are the instructions that I was given in the course that I am trying to follow:

 

Open a new program window and perform the following tasks:

  1. Write a PROC CONTENTS step to generate a report of the storm_summary.sas7bdat table.
    • SAS Studio: Specify the path to your EPG194/data folder and the full name of the table.
    • Enterprise Guide: Specify &path and the full name of the table.

 

proc contents data="FILEPATH/storm_summary.sas7bdat";

run;

7 REPLIES 7
ballardw
Super User

What is the assigned value of the macro variable PATH?

 

Are you connecting to a server? The path would likely execute from the server and likely can't reference your hard drive if that is the location indicated by Path.

 

What does your LOG show?

 

 

ballardw
Super User

What is the assigned value of the macro variable PATH?

 

Are you connecting to a server? The path would likely execute from the server and likely can't reference your hard drive if that is the location indicated by Path.

 

What does your LOG show?

 

 

Reeza
Super User
Are you using SAS EG or Studio? Online (SAS academics on Demand or UE).

Each will have a slightly different path.
Cynthia_sas
SAS Super FREQ

Hi:
Reeza is correct. Every method of using SAS has different instructions for making the data. And every method of using SAS has a slightly different path location for the data.

 

If you are using Enterprise Guide, we have specific instructions for you to make a process flow called AUTOEXEC because that runs EVERY time you open the project and creates the data in WORK. We make the data in WORK on EG because frequently EG folks have issues finding a write access location if they are running SAS on a server. In this case &PATH is created by the programs in the AUTOEXEC process flow. So you must use the instructions to make the data.

 

If you are NOT using Enterprise Guide, then you either need a %LET statement or you need to just use the fully qualified path, based on your location for the Programming 1 data when you followed the instructions. In the instructions for making the data, we show you how to right click in SAS Studio to find the correct name for the path. If you are using SAS Studio, this should be very easy to do. If you are using SAS on Windows, this is also possible to do with just a few more keystrokes. With EG, it is easiest of all because we create &PATH for you.

 

  However, specifically in regard to storm_summary data and the PROC CONTENTS practice. Assuming you followed the instructions and made an EPG194 folder with the subfolders inside of it, there are examples below for every method of using SAS (except for the mainframe) for the storm_summary activity.

 

For example:
1) Full path method
SAS University Edition
proc contents data="/folders/myfolders/EPG194/data/storm_summary.sas7bdat";

 

SAS OnDemand for Academics
proc contents data="/home/<yourUserID>/EPG194/data/storm_summary.sas7bdat";

 

SAS Enterprise Guide
-- MUST run AUTOEXEC so that &PATH is created, then:
proc contents data="&path/storm_summary.sas7bdat";

 

SAS On Windows using Display Manager
proc contents data="C:\SAS_Class\EPG194\data\storm_summary.sas7bdat";

 

SAS On Unix using X-Windows and Display Manager type Window
proc contents data="/usr/bin/xxxyyy/EPG194/data/storm_summary.sas7bdat";

 

2) Use &PATH method
SAS University Edition
%let path=/folders/myfolders/EPG194/data;
proc contents data="&path/storm_summary.sas7bdat";

 

SAS OnDemand for Academics
%let path=/home/<yourUserID>/EPG194/data;
proc contents data="&path/storm_summary.sas7bdat";

 

SAS Enterprise Guide
%let path=%sysfunc(pathname(WORK)); <-- this code is used in the AUTOEXEC programs
proc contents data="&path/storm_summary.sas7bdat";

 

SAS On Windows using Display Manager
%let path=C:\SAS_Class\EPG194\data;
proc contents data="&path/storm_summary.sas7bdat";

 

SAS On Unix using X-Windows and Display Manager type Window
%let path=/usr/bin/xxxyyy/EPG194/data;
proc contents data="&path/storm_summary.sas7bdat";

 

Hope this helps. Later in Programming 1, we will show you the LIBNAME statement and an even easier way to reference a SAS data set.

 

Cynthia

CP3X
Calcite | Level 5

Thank you all for your quick responses. They helped clarify possible issues.

 

And then It turns out that this:

 

proc contents data="&path/storm_summary.sas7dbat";

 

needed to be this:

 

proc contents data="&path/storm_summary.sas7bdat";

Cynthia_sas
SAS Super FREQ
So sorry, that was my bad. I'll correct the earlier post.
Cynthia
rhodesc2801
Calcite | Level 5

Yeah Cythina, awesome information.  Also in Studio you can click on the file and select properties to get the filepath. 

 

Thanks,

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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