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-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
  • 7 replies
  • 760 views
  • 3 likes
  • 3 in conversation