09-05-2017 08:56 AM
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
rc = system( 'pwd' );
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.
09-05-2017 09:18 AM - edited 09-05-2017 09:21 AM
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;
09-05-2017 09:20 AM
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;
09-05-2017 09:58 AM
09-05-2017 10:02 AM
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.
09-05-2017 10:08 AM