1
votes

enter image description here

enter image description here

enter image description here

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/model_v1, and when I run a Linux command like X "pwd" then I expect that the result will give /sasdata/model_v1, 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.

If I find the directory, then I guess it should be enough to save them as macro-variable by using %let macrovariable = "/directory"

1
Please provide more detail on your environment. What version of SAS/Studio? What version of SAS? Are you opening the CPF file in the SAS/Studio interface and submitting it? Or does SAS/Studio support submitting the CPF file in the background from a source file like it does when running a regular SAS program?Tom
@Tom it is 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. And yes, I open the CPF-file in SAS-Studio interface and I submit the SAS-commands in this interface. I add a screenshot to show how the CPF-file is located. It seems like physically it is located under /sasdata/... but the command X "pwd" gives the directory /sasinstall/... insteaduser3714330
The current directory of the SAS process will just be the current directory from when the SAS workspace server process was launched. Change your settings in SAS/Studio so that your log shows what SAS/Studio submitted as lines 1 to 60 and check if it has set any macro variables that contain the path or filename. That is your only hope.Tom

1 Answers

3
votes

I don't think SAS will show you the path of the process file. It doesn't in SAS/Studio 3.5.

It will set the path for a normal program file (as long as you have saved it) in the _SASPROGRAMFILE macro variable.