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

Hi  all of my friends, hope all of you are very well. I have one sas file with multiple program and I need the following programs for every of my program written in it.

libname Learn '/folders/myfolders/60864_example/Learning';
libname CharData '/folders/myfolders/Dataset/CharDataset';
libname Learn '/folders/myfolders/60864_example/Learning';
libname CharData '/folders/myfolders/Dataset/CharDataset';

 libname Learn '/folders/myfolders/60864_example/Learning';
libname CharData '/folders/myfolders/Dataset/CharDataset';

 

Then for each program I have to put these two libraries above the program for example

"libname Learn '/folders/myfolders/60864_example/Learning';"
"libname CharData '/folders/myfolders/Dataset/CharDataset';"
"proc print data=Learn.phone obs='5';"
run;

I would like to define these two libraries once at the top of the sas file and it would work for all the program written in that file.

 

Thank you very much, I am looking forward for your descent answers.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ghosh
Barite | Level 11

looks like you are using SAS UE.  On the top right of the screen there is a menu before the ?

you can edit the autoexec.sas from thereUntitled.png

View solution in original post

7 REPLIES 7
seamoh
Obsidian | Level 7

Hi and ghosh, and thank you very much for the reply

what is your idea about this

libname Learn '/folders/myfolders/60864_example/Learning';
options fmtsearch=(learn);

 

I put these two lines of cose at the first of the sas files and run it once  and I think it works for the rest of the programs on the file.

Please tell me your idea ,

Thank you very much

ghosh
Barite | Level 11

You can write your libname as follows:

libname Learn '~/60864_example/Learning';

This was your code is portable assuming the /60864_example/Learning part of your folder is the same on the other computer

PaigeMiller
Diamond | Level 26

Put these LIBNAME statements into your AUTOEXEC file and then you don't even need them at the top of each program you write.

--
Paige Miller
seamoh
Obsidian | Level 7

Hello PageMiller, this is what  ghosh suggest me in his first reply. would you please tell me where may I find the Autoexec file? Thank you again PageMiller and ghosh, deeply appreciated of both of you my friends.

ghosh
Barite | Level 11

looks like you are using SAS UE.  On the top right of the screen there is a menu before the ?

you can edit the autoexec.sas from thereUntitled.png

PaigeMiller
Diamond | Level 26

In SAS, run this command

%put %sysfunc(getoption(autoexec));
--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1049 views
  • 3 likes
  • 3 in conversation