If i have a program whose pathway is "C:\SASMACRO\WISC4.sas"
How could I automaticly load it in sas everytime I start to use SAS.
Thanks for the clarification. So, it's case A from the list in my previous post. Here are the steps to achieve what you want (assuming a Windows system):
dm 'whostedit'; /* opens an Enhanced Editor window (optional) */
dm 'fileopen "C:\SASMACRO\WISC4.sas"'; /* opens your program */
dm 'wpgm' continue; /* switches the focus back to the empty Enhanced Editor window (optional) */
Additional information:
SAS searches several locations for autoexec.sas files: please see section "The Default Autoexec File" in Files Used by SAS. So, the above assumes that SAS doesn't find another autoexec.sas in a location with higher priority.
On my workstation I use an autoexec file with a different name and in a different location, which is specified in the -AUTOEXEC system option that I apply when launching SAS. I can give you further instructions if you want to go this route instead.
you include it in the autoexec file.
Here is the documentation :
Hi @ffgsdf,
It is not quite clear from your question whether you want to run WISC4.sas or to open it (in the Enhanced Editor).
The good thing is that @Loko's suggestion works for both purposes:
The following line in your autoexec.sas (you can name this program differently) will run the program automatically when you launch SAS:
%inc 'C:\SASMACRO\WISC4.sas';
The following line will open the program automatically in the Enhanced Editor when you launch SAS:
dm "fileopen 'C:\SASMACRO\WISC4.sas'";
If this is to make a SAS macro available (as your path name suggests), you may also want to read about autocall libraries.
Hi, Loke and FreelanceReinha
I am sorry to confuse you about my description of question.
I want to sas open the macro I told as a memo because I learn that Rsutdio has this function, too.
I think it is a funcition to remind me and make my write code quicker.
I have read the sas auto and the autoexec file.
however, i failed to do it.
Can you give me the exact code with the example "C:\SASMACRO\WISC4.sas" to help me do it.
thx
Hi @ffgsdf,
I would like to write SAS code more quickly, too, but I'm not familiar with RStudio. So, I'm curious what type of code your program WISC4.sas contains. Is it
Hi, FreelanceReinha
The function of the program i want to sas open automaticly is some data management.
like some array syntax, merge syntax, anaylsis syntax.
I dont wnat to SAS execute them when I open it.
Instead, I want to SAS just open it like I ask SAS open a program.
like the photo i attached.
Thanks for the clarification. So, it's case A from the list in my previous post. Here are the steps to achieve what you want (assuming a Windows system):
dm 'whostedit'; /* opens an Enhanced Editor window (optional) */
dm 'fileopen "C:\SASMACRO\WISC4.sas"'; /* opens your program */
dm 'wpgm' continue; /* switches the focus back to the empty Enhanced Editor window (optional) */
Additional information:
SAS searches several locations for autoexec.sas files: please see section "The Default Autoexec File" in Files Used by SAS. So, the above assumes that SAS doesn't find another autoexec.sas in a location with higher priority.
On my workstation I use an autoexec file with a different name and in a different location, which is specified in the -AUTOEXEC system option that I apply when launching SAS. I can give you further instructions if you want to go this route instead.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.