BookmarkSubscribeRSS Feed
JaxonKing
Fluorite | Level 6

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.

14 REPLIES 14
Kurt_Bremser
Super User

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".

JaxonKing
Fluorite | Level 6

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.

JaxonKing
Fluorite | Level 6

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.

Kurt_Bremser
Super User

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:

  • your SAS server uses a UNIX system and needs different pathname syntax
  • the (obvious) shared network resource is not available on the server
  • there is a subtle mistake in the spelling of the path

just to name a few

JaxonKing
Fluorite | Level 6

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.

Cynthia_sas
SAS Super FREQ

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

Janny
Calcite | Level 5
hi Cynthia,
I am facing the same error here when doing PG1 elearning activities:
here is what I worte in SAS studio via OnDemand
proc contents data="C:\Users\sbjjnl\Desktop\elearning_data\EPG1V2/data/storm_summary.sas7bdat";
run;
Then I got the log error "ERROR: physical file name "C:\Users\ SBJJNL \Desktop\elearning_data\EPG1V2\data\storm_summary.sas7bdat" is too long."

here is the complete log info
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
70
71 proc contents data="C:\Users\sbjjnl\Desktop\elearning_data\EPG1V2\data\storm_summary.sas7bdat";
ERROR: 物理文件名“C:\Users\sbjjnl\Desktop\elearning_data\EPG1V2\data\storm_summary.sas7bdat”过长。
72 run;

NOTE: 由于上述错误,没有处理语句。
NOTE: “PROCEDURE CONTENTS”所用时间(总处理时间):
实际时间 0.00 秒
用户 CPU 时间 0.00 秒
系统 CPU 时间 0.00 秒
内存 470.65k
OS 内存 32384.00k
时间戳 2020-05-28 上午08:00:05
Step Count 122 Switch Count 0
页错误数 0
页回收数 56
页交换数 0
主动上下文切换数 0
被动上下文切换数 0
块输入操作数 0
块输出操作数 8

NOTE: 由于出错,SAS 系统停止处理该步。
73
74 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
85

please help and indicate which part I was wrong, thanks a lot.
Janny
Calcite | Level 5
thank you so much for pointing this out! it works this time!!
Cynthia_sas
SAS Super FREQ
Hi: Please do not bury your post inside another posting. I almost didn't see it. How are you using SAS:
1) local copy of SAS on windows (click the SAS icon from the Start Menu)
2) SAS University Edition in a Virtual Machine (start SAS Studio by first opening Virtual Box or VMWare Player to start)
3) SAS OnDemand for Academics (start SAS Studio by clicking in SAS Control Center Dashboard)
4) Using SAS Enterprise Guide

The instructions you follow will determine how you should write your code. Are you using SAS Studio? If you right click on the storm_summary.sas7bdat file and choose Properties, what is the full path you see in the Location field in the Properties window -- this is what you should have in your code.

Post a screen shot of your Properties field and then post the log that shows an error message on that same path....that EXACT same path.

Cynthia
howardtsai
Calcite | Level 5

 

Spoiler
This is for the web-based SAS Studio version. Right click the (virtual) folder where the file is and click "properties." It will show you the path. Mine is /home/u167737/EPG1V2/data. So the correct programming line would be


proc contents data="/home/u167737/storm_summary.sas7bdat"; run;
Good luck!

 

 

Cynthia_sas
SAS Super FREQ

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 14 replies
  • 2887 views
  • 5 likes
  • 5 in conversation