BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aaronbailey79
Fluorite | Level 6

Taking SAS programming 1(in middle of lesson 7) using SAS university edition.

 

In the practice problem I am working on, this code should work (I haven't included my full path for privacy reasons).

 

__________

 

libname custfm pcfiles path="&path/custfm.xls";

 

proc contents data=custfm._all_;
run;

 

data work.males;

run;

 

proc print data=work.males label;
run;

 

libname custfm clear;

____________

 

 Problem 1) The path that should contain custfm.xls ends in the folder ecprg193, which doesn't contain that file with the info to complete the practice.

 

Problem 2) SAS university edition doesn't have pcfiles engine to assign a libref to an excel file, and the directions are unclear what engine I should use. I am using an imac if that is helpful.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Actually if memory serves correctly, you're only supposed to watch that section, it says it somewhere in there that you can't run it with SAS UE. You may be able to find that reference somewhere on here. I believe it was via Cynthia from SAS.

View solution in original post

7 REPLIES 7
Reeza
Super User

Regarding #2 try either Excel or XLSX instead of PCFILES. The format is slightly different:

 

libname custfm excel 'path to excel file';

libname custfm xlsx 'path to excel file';

Your paths should pretty much be '/folders/myfolders/ecprgm/...' so not sure what that needs to be masked in SAS UE. 

 

Using a Mac or PC doesn't affect any of the code or options you need to use here. 

Revisit the setup instructions and see if the set up instructions reference custfm or if there are any errors when it runs that reference it. 

SASNardo92
SAS Employee
Regarding the 1st one, I think there should be a folder like excel files or something like that. Check for it
Reeza
Super User
Actually if memory serves correctly, you're only supposed to watch that section, it says it somewhere in there that you can't run it with SAS UE. You may be able to find that reference somewhere on here. I believe it was via Cynthia from SAS.
aaronbailey79
Fluorite | Level 6

Okay, thank you! I will stop tearing my hair out.

Reeza
Super User

I would still make sure you know how to access/import an Excel file, but you can follow the tutorials on video.sas.com > How To Tutorials>Analytics U

 

Good Luck!

ballardw
Super User

You will want to watch concatenation of strings in the macro language.

Instead of

path="&path/custfm.xls"

better would be.

 

path="&path./custfm.xls"

 

The period indicates the end of the macro variable. Often if you do not use it with other text you will get a "macro variable not found" because the macro processor will think you had a different variable in mind. Suppose that your &path variable included the / as the last character. You might have referenced:

path="&pathcustfm.xls" thinking that the / resolves. But the macro processor would be looking for a macro variable name pathcustfm.

Reeza
Super User

SAS treats the characters '\' & '/' as delimiters for macro variables as well and it resolves correctly without the  period.

 

%let path_folder = C:\_localdata\;

libname test "&path_folder\temp";

The log will show both work the same:

 

129  %let path_folder = C:\_localdata\;
130
131  libname test "&path_folder/temp";
NOTE: Libref TEST was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\_localdata\\temp

132  %let path_folder = C:\_localdata\;
133
134  libname test "&path_folder\temp";
NOTE: Libref TEST was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\_localdata\\temp

135  libname test "&path_folder.\temp";
NOTE: Libref TEST was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\_localdata\\temp

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
  • 1389 views
  • 6 likes
  • 4 in conversation