I need to manage the historical versions of the model manually, and my plan was creating a copy of the model under another map and SAS would recognize the new map automatically without changing the macro variables.
I am trying to make a macro variable in SAS Studio which saves the "present working directory" as a macro variable.
The SAS-program is run in a "CPF
" process flow file in SAS Studio, and the whole SAS-file and processes are saved and run in a Linux server.
In SAS-Studio, the location of CPF-process flow file seems like in the directory /sasdata/prodpgm/Test..., and when I run a Linux command like
data _null_;
rc = system( 'pwd' );
%put rc;
run;
then I expect that the result will give /sasdata/prodpgm/Test..., but I get another directory instead like /sasinstall/sasconfig/Lev1/SASApp instead, I guess the the process flow file with CPF-suffix is run from this directory.
So the question is how I can find and save the working directory of my cpf
-file and save as a macro-variable, or even maybe for my other sas-files too, I may need the solution for both SAS-files and CPF-files.
I asked the same question on another forum, and some said that SAS-Studio can't find your working directory automatically, I need to assign the path myself.
The software specifications: SAS Studio release 3.6 (enterprise edition). SAS release: 9.04.01M4P11092016. SAS platform: Linux LIN X64 3.10.0-514.26.1.el7.x86_64.
Beginning with SAS 9.4 TS1M4, you can change the current working directory via SAS code by using the new DLGCDIR function. Here is an example:
data _null_;
rc=DLGCDIR(“/sasdata/prodpgm/”);
put rc=;
run;
Also, in SAS 9.4 TS1M4 you can use the following code to write the value of the current working directory to the log:
data _null_;
rc=DLGCDIR();
put rc=;
run;
That's right because you are starting the workspace server from the configuration directory.
without referring manually.
You should be able to use these statements with DLGCDIR in an AUTOEXEC file in SAS Studio so that they get submitted to SAS each time you invoke SAS Studio.
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.