BookmarkSubscribeRSS Feed
ghosh
Barite | Level 11

I would like to include into a current SAS program a file that exists in parent directory.  I would rather not hardcode the path so it can be used from any child directory.  

 

I am working in a UNIX environment

 

I have tried:

%include "../myconfig.sas";

%include "~/myconfig.sas";

%include "..\myconfig.sas";

%include "~\myconfig.sas";

Thanks

6 REPLIES 6
tomrvincent
Rhodochrosite | Level 12
You can use _CLIENTPROJECTPATH and remove the last subdirectory.
ghosh
Barite | Level 11

i am getting  its value as blank ''

 

%put &_CLIENTPROJECTPATH; 

tomrvincent
Rhodochrosite | Level 12
it only works within a project that has been saved.
ghosh
Barite | Level 11

Is there way to get the current path where the SAS program file is located on a SAS server without using a project .egp file?

 

Thanks

tomrvincent
Rhodochrosite | Level 12
Then, 'parent directory' of *what*?
ghosh
Barite | Level 11

The parent directory of the executing sas file.

 

But never mind, I have derived it from the macro variable &_SASPROGRAMFILE which does exist when a SAS code runs in EG.

 

Thanks for pointing me to the right direction.

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
  • 6 replies
  • 1809 views
  • 2 likes
  • 2 in conversation