SAS Enterprise Guide: Set a prompt both in Local and Metadata Server - sas

I have a prompt that generate a variable across all my project (the SET_ENVIRONMENT macro variable).
I then run my programs on by one in my process flow.
The only problem is that some of them are local (when I want to upload data), and some of them are remote (using sas metadata server).
A solution would be to run my SET_PROMPT program twice, once on my local, once on my SAS Metadata Server.
I was wondering if it was possible to do set both prompts at the same time?

If this works like a SAS/CONNECT session, then what you might do is link your prompt to a program in the local session. Have that program then be responsible for using %SYSRPUT to assign the variable on the metadata server, and have that program be always the first program you execute. That way you don't need two prompts (which is annoying for the user) but get it assigned in two places at once.

Related

Changing SAS working directory on Citrix machine

I'm running SAS EG 7.1 on a Citrix machine at work. I'm trying to do a very large sql pull and keep running out of disk space. Our server drive has plenty of storage, so I assume switching the working directory to a folder on that drive temporarily will avoid this error?
The error says "insufficient disk space....file is damaged. I/O processing did not complete. You may be able to execute sql statement successfully if you allocate more space to the WORK library." I don't seem to have access to the config file and I've tried to change it programmatically with no luck. I am trying to save the resulting dataframe to a server folder already with a LIBNAME statement, but I think the temporary files created in WORK during the process are too much to handle. Any help?
I've tried both:
x 'cd "Q:\folder"';
and
data _null_;
rc = system( 'cd "Q:\folder"' );
if rc = 0
then putlog 'Command successful';
else putlog 'Command failed';
run;
These run fine, but in the log it still says my working directory is unchanged:
SYMBOLGEN: Macro variable SASWORKLOCATION resolves to "C:\Users\user\AppData\Local\Temp\SEG5432\SAS Temporary
Files\citrixMachineDrive\Prc2/"
The current directory is relevant for file references and such, but it's not related to your Work or Util directories.
WORK and UTIL are only settable at startup, and are either set in the arguments for sas.exe or in the sasv9.cfg configuration file. How you solve your particular problem depends on whether EG is connecting to a SAS server, or if it's just running locally. If it's running locally, you may be able to modify the startup options. If it's connecting to a server, you will have to talk to your SAS administrator.
However, it's highly unlikely you would want to use the network folder as your WORK folder. SAS expects high speed disk connected directly to the machine for WORK; if you set it to a network drive, your performance would be extremely poor.
Also note that "C:" is on the machine the SAS server is running on - it might be the same machine, if you're running SAS locally (on Citrix), but if it's a remote SAS server then the C:\ is on that server.

Cannot run SAS EG scheduler through SAS app

I have set up a schedule program (the one sas have developed themself) which open my SAS EG and runs it, and it is normally working fine then I run on my local server, but if I run through SAS app it fails.
My question: Do you know a way I can schedule SAS EG running on a SAS app?
If your "schedule program" runs locally you may need to wrap your SAS code in rsubmit and endrsubmit statements to ensure it is submitted remotely (on the SASApp server).
See documentation.
If you want to run your code on the GRID , use rsubmit and endsubmit statements at the beginning and end of your code respectively.

How to run SAS using batch if I do not have it locally

Is there a way to run SAS using batch if I don't have the sas.exe in my machine?
My computer has the SAS EG but the code is ran on our companies servers
Thanks
If you are asking whether it is possible to run SAS batch on your local machine without having SAS on your local machine, the answer is no.
If you are using EG to connect to a SAS server, and you want to execute a batch job on the SAS server, that is possible (just not with EG). For example, if you have terminal access to the SAS server via putty or whatever, you can do a batch submit.
Enterprise Guide is quite capable of scheduling jobs, whether or not you have a local SAS installation.
Wendy McHenry covers this well in Four Ways to Schedule SAS Tasks. Way 1 is what you probably are familiar with ('batch'), but Ways 2 through 4 are all possible in server environments.
Way 2 is what I use, which is specifically covered in Chris Hemedinger's post Doing More with SAS Enterprise Guide Automation. In Enterprise Guide since I think EG 4.3, there has been an option in the File menu "Schedule ...", as well as a right-click option on a process flow "Schedule ...". These create VBScript files that can be scheduled using your normal Windows scheduler, and allow you to schedule a process flow or a project to run unattended, even if it needs to connect to a server.
You need to make sure you can connect to that server using the credentials you'll schedule the job to run under, of course, and that any network connections are created when you're not logged in interactively, but other than that it's quite simple to schedule the job. Then, once you've run it, it will save the project with the updated log and results tabs.
If your company uses the full suite of server products, I would definitely recommend seeing if you can get Way 3 to work (using SAS Management Console) - that is likely easier than doing it through EG. That's how SAS would expect you to schedule jobs in that kind of environment (and lets your SAS Administrator have better visibility on when the server will be more/less busy).

sas run time difference

I use pc sas 9.4. But the server is on Linux, so instead of running my program in batch on the server I have a little script I run at the top of my program which uses a remote engine to connect. I also assign a libname and run my datasteps which create permanent datasets. However when I do this, my program runs for 6 hours, but when I run the program without a libname, meaning the datasets are generated in my work directory, the same program runs in 10 minutes. No one seems to know why that is, and I was told to just run my code directly on the unix server. I don't like the look of sas on unix, and using unix editors, saving .sas files to run them. I prefer using the sas windows GUI. Why is there such a difference in runtime?
Many thanks in advance.
As you are not using rsubmit; you are actually not working on the server, only your data is stored on the server. You are downloading the data from the server to your PC before performing any calculations. Depending on your network, this will take some time.
Try this:
rsubmit XXX_server_name;
... Your Code ...
endrsubmit;
That way you will be working on the server, not just using data in a library on the server.

SAS EG: including local file while running on server

How can I use include statement to reference local file when I'm connected to server?
When I run the code I get an error saying that there is no such file on the server.
How do I tell EG to look for file locally?
I have ways to get around that, like telling the code to run on 'local' server and then
I copy results over. Or I just add the code I need as a Code node in EG.
Both of those are not very practical when working with old code that uses include heavily.
In Enterprise Guide, programs (code nodes) have an option to choose the environment. Choose LOCAL for the program that executes the %INCLUDE for the local program. Then you need to move the resulting data set(s) to the remote server via SAS/CONNECT (RSUBMIT) and put them in a permanent location. The subsequent programs can have your remote server chosen as the environment and will be able to act on the data you previously moved up the remote server.
If this seems plausible...I can expand the answer
If you are looking to reference local SAS data sets (sas7bdat files), you can use the Tasks->Data->Upload Data Files to Server task. This will capture the step of copying your data set files to the SAS workspace as part of your process flow.