I am having a slight issue when trying to do the proc contents data activity. When putting the code in with my file it is coming up with the error the physical name is too long (5 folders deep in Z drive to get to EPG1V2). Even after shortening it to a couple of folders higher than EPG1V2 it still gives the same message, am I missing something with my formatting?
proc contents data="Z:\Users\UKGC\Documents\Coding\SAS\EPG1V2\data\storm_summary.sas7bdat";
run;
The above is the code I am using.
Assign a libname first:
libname test "Z:\Users\UKGC\Documents\Coding\SAS\EPG1V2\data";
then use the library to address your dataset:
proc contents data=test.storm_summary;
run;
Use any valid SAS name with a maximum length of 8 in place of "test".
Thank you for your reply, unfortunately, the solution didn't work, it comes up with a different error and creating libraries was the next section of the course so hopefully, I can figure out the new issue there.
I am trying to find out what the issue was with the physical file name length and which bit I need to change to hard code the pathway as in the course, can't understand the error as the storm_summary.sas7bdat is used in the example in the course.
Please post the logs of your initial try with the physical name, and that of the libname assignment.
Use the </> button to post logs.
This is the initial code and log that was used.
proc contents data="Z:\Users\UKGC\Documents\Coding\SAS\EPG1V2\data\storm_summary.sas7bdat"; run;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 proc contents data="Z:\Users\UKGC\Documents\Coding\SAS\EPG1V2\data\storm_summary.sas7bdat"; ERROR: The physical file name "Z:\Users\UKGC\Documents\Coding\SAS\EPG1V2\data\storm_summary.sas7bdat" is too long. 74 run; NOTE: Statements not processed because of errors noted above. NOTE: PROCEDURE CONTENTS used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 470.65k OS Memory 29864.00k Timestamp 05/23/2020 02:54:52 PM Step Count 108 Switch Count 0 Page Faults 0 Page Reclaims 61 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 8 NOTE: The SAS System stopped processing this step because of errors. 75 76 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 88
Then the libname adaption that you suggested to me with the log.
libname coding "Z:\Users\UKGC\Documents\Coding\SAS\EPG1V2\data"; proc contents data=coding.storm_summary; run;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 libname coding "Z:\Users\UKGC\Documents\Coding\SAS\EPG1V2\data"; NOTE: Library CODING does not exist. 74 75 proc contents data=coding.storm_summary; ERROR: File CODING.STORM_SUMMARY.DATA does not exist. 76 run; NOTE: Statements not processed because of errors noted above. NOTE: PROCEDURE CONTENTS used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 473.93k OS Memory 29864.00k Timestamp 05/23/2020 03:40:56 PM Step Count 114 Switch Count 0 Page Faults 0 Page Reclaims 63 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 8 NOTE: The SAS System stopped processing this step because of errors. 77 78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 90
sorry if I have missed something basic but I just can't figure out what has gone wrong.
This is your clue:
NOTE: Library CODING does not exist.
SAS cannot "see" the path you specified. There are lots of possible reasons for this:
just to name a few
Thank you,
As I was working on the files and data sets from the course download the file directory that I called from was different from where some of it is saved. I changed the file pathway and it is now working for both the initial and the library function.
Had to right-click properties on the storm_summary to find out it was different.
Thank you for your help and time.
@JaxonKing wrote:
Thank you for your help and time.
You're welcome! Glad if I could point you in the right direction.
Hi:
Just a note. There are 2 PROC CONTENTS activities using the storm_summary data. In the first activity, we want you to use a fully qualified path name so that you see it IS possible to use an operating system specific path name for the data= option.
For example, on my SAS University Edition folder, the fully qualified path for the storm_summary file is:
/folders/myfolders/EPG1V2/data/storm_summary.sas7bdat
On SAS OnDemand for Academics, the fully qualified path for storm_summary is:
/home/<userID>/EPG1V2/data/storm_summary.sas7bdat
On SAS for Windows local install, the fully qualified path is:
c:\SAS_class\EPG1V2\data\storm_summary.sas7bdat
So, the first PROC CONTENTS activity has you do this:
proc contents data="/folders/myfolders/EPG1V2/data/storm_summary.sas7bdat";
run;
or
proc contents data="/home/<userID>/EPG1V2/data/storm_summary.sas7bdat";
run;
or
proc contents data="c:\SAS_class\EPG1V2\data\storm_summary.sas7bdat";
run;
After we show students that they CAN use an operating system path name, next we show students the LIBNAME method as explained by @Kurt_Bremser. With a proper LIBNAME statement such as:
libname pg1 "/folders/myfolders/EPG1V2/data";
libname pg1 "/home/<userID>/EPG1V2/data";
libname pg1 "c:\SAS_class\EPG1V2\data";
Then the PROC CONTENTS code would be the same:
proc contents data=pg1.storm_summary;
run;
Hope this clarifies what we were intending in the course. If you're using SAS Studio, it is always possible to find the correct path for the LIBNAME statement by doing a right-mouse-click on the data subfolder under EPG1V2 and then choosing Properties. The Location field in the Properties window will show you the correct path to use for your LIBNAME statement.
Or, you can right-click on the data table file (the sas7bdat file) and choose Properties if you prefer to use the full operating system path method.
Cynthia
Please read and follow the instructions for your environment. SAS on Demand runs on UNIX servers in the cloud and does NOT have access to your C: drive.
proc contents data="/home/u167737/storm_summary.sas7bdat"; run;Good luck!
Hi:
Actually, you have to account for the full path in the data= option when you use the full filename and extension. When we create the data for the course, we put the storm_summary.sas7bdat file in the EPG1V2/data folder. So in this case, the correct path would be:
proc contents data='/home/<youruserID>/EPG1V2/data/storm_summary.sas7bdat';
run;
All absolute file paths on the On-Demand server must start with /home/<youruserID>/ (everybody has a different userID. Then the class folder (if you followed the instructions) of EGP1V2/ and the subfolder of data/. Finally the file name and file extension, storm_summary.sas7bdat. Later in the class, we'll show you how to use a LIBNAME statement to bypass the need to use the fully qualified path like this.
We always recommend the right-click and Properties method to see the full path.
Cynthia
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.