Break / Quit / Exit in SAS - sas

I am using SAS Enterprise Guide and am running a program that runs for a long time (about 30 min).
I want to be able to do the following:
Exit my program at a defined point.
Examine the contents of the Log at this point.
Is there a command that allows me to do the above? I am basically looking for something like a break/exit/quit statement that maintains the SAS Log.

The Enterprise Guide way of doing this is to break your program into multiple smaller program files. Then you run each of those, either individually if you want to be able to see the details before moving on, or in a linked flow if you want to just run them whole thing and see outputs but not stop it (though you could always stop it using the stop button if something came up).

Related

Process flow gets stuck on table creations

I'm trying to understand the Enterprise Guide process flow. As I understand it, the process flow is supposed to make it easy to run related steps in the order they need to be run to make a dependent action able to run and be up to date somewhere later in the flow.
Given that understanding, I'm getting stuck trying to make the process flow work in cases where the temporary data is purged. I'm warned when closing Enterprise Guide that the project has references to temporary data which must be the tables I created. That should be fine, the data is on the SAS server and I wrote code to import that data into SAS.
I would expect that the data can be regenerated when I try run an analysis that depends on that data again later, but instead I'm getting an error indicating that the input data does not exist. If I then run the code to import the data and/or join tables in each necessary place, the process flow seems to work as expected.
See the flow that I'm working with below:
I'm sure I must be missing something. Imagine I want to rerun the rightmost linear regression. Is there a way to make the process flow import the data without doing so manually for each individual table creation the first time round?
The general answer to your question is probably that you can't really do what you're wanting directly, but you can do it indirectly.
A process flow (of which you can have many per project, don't forget) is a single set of programs/tasks/etc. that you intend to run as a group. Typically, you will run whole process flows at once, rather than just individual pieces. If you have a point that you want to pause, look at things, then continue, then you have a few choices.
One is to have a process flow that goes to that point, then a second process flow that starts from that point. You can even take your 'import data' steps out of the process flow entirely, make an 'import data' process flow, always run that first, then run the other process flows individually as you need them. In fact, if you use the AUTOEXEC process flow, you could have the import data steps run whenever you open the project, and imported data ready and waiting for you.
A second is to use the UI and control+click or drag a box to select on the process flow to select a group of programs to run; select the first five, say, then run them, then select 'run branch from program...' option to run from that point on. You could also make separate 'branches' and run just the one branch at a time, making each branch dependent on the input streams.
A third option would be to have different starting points for different analysis tasks, and have the import data bit be after that starting point. It could be common to the starting points, and use macro variables and conditional execution to go different directions. For example, you could have a macro variable set in the first program that says which analysis program you're running, then the conditional from the last import step (which are in sequence, not in parallel like you have them) send you off to whatever analysis task the macro variable says. You could also have macro variables that indicate whether an import has been run once already in the current session that then would tell you not to rerun it via conditional steps.
Unfortunately, though, there's no direct way to run something and say 'run this and all of its dependencies', though.

How to make SAS Enterprise Guide show only the latest data created in Output Data?

Also how to make SAS Enterprise Guide to go to Output Data tab after a successful run instead of Results tab?
It's going to go to Results if you produce results, I don't think there's any way around that. You will get all of the datasets produced in that program in the Output Data tab, as well.
However, I'm going to venture a guess here: you're using EG like a single window programming environment, right? You have a single long program? If so, then the answer is simple: split your program up. EG is intended to have lots of small programs, each of which have a very specific goal and output. Think of it as steps: each program node is just one step, could be even just one data step. Then you link several programs together, in sequence, and run them all as a process flow (or an ordered list).
If you treat it that way, then it works very much like you say: you can have one program that has one output dataset and no results window, if your last program in a process flow just produces one dataset and no results.

Stop SAS from running after encountering an error

is there a simple option that will cause SAS to stop running when it encounters an error. Something similar to the option ERRORABEND, except without quitting SAS?
I have seen other questions - e.g. Stop SAS Program on Error, and Stop SAS macro execution on error however those questions seemed somewhat different in that either dealing with remote server / handling expected errors at known places. I find it hard to believe/understand that there is no simple way of stopping at errors except by placing macros throughout the code to look for errors.
I believe the thing you are looking for is the break button on the application toolbar. It is the exclamation mark with the circle around it.
Note: make sure not to hit the clear all button (which is the stylized 'X')!! It will clear all your program editor code and cannot be undone.
You can use options syntaxcheck ; to enable syntax-checking mode after an error.
So, to enable what I think you want to achieve :
options noerrorabend syntaxcheck ;
https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#base-sysop-syntaxcheck.htm

SAS Enterprise: Run multiple Process Flows at once

I can't seem to find a straightforward way to run multiple process flows at once. I can select multiple and right click, but the 'Run' function disappears.
Any ideas? Programmatic or otherwise?
Assuming you mean you want to run multiple flows sequentially, you would use an Ordered List to do that. You can include any number of programs in a process flow.
Process flows are intended to contain all of the items you want to run in one shot, so you would not normally run many entire process flows at once. You can of course run one, then run the next one, if it's a few. I don't believe you can link programs or objects from one process flow to another.
If you mean run simultaneously, then you can do that if you set your project up to allow parallel execution, and your server allows it. File -> Project Properties -> Code Submission, check "Allow parallel execution on the same server" allows you to run multiple things at once - but be aware that each submission is in its own distinct SAS session and doesn't have direct access to the other submissions' temporary libraries or macro variables.

Hot to re-run a C++ code from a specific point in the middle of the code, after changing the code below that point?

So, I have a program in C++ and I use visual studio 2010. My program is mostly procedural not object oriented programming though. The first part of my program does something, then the second half does something else that uses the information of the first half. The first half takes a while (~ 20 minutes) to run (I knew this through running it in debug mode and put a break point right after the end of that first half).
The thing is that I am experimenting different ideas for that second half. Now, whenever I write the code for any new idea, I have to run the whole code from scratch, and thus have to wait the 20 minutes before the new second half runs. This is very inconvenient/inefficient; since I will be doing this for a while. I also can not really write all my ideas at once and run different programs (with the same first half and different second halves corresponding to each idea) simultaneously, just because I get each new idea after I run the older one and understand somethings about the behavior of my algorithm.
So, is there any way I can start running the code right after the first part whenever I change something(s) in the second part, instead of having to compile it and run it from scratch each time I change something in the second part? And how is that, if possible?
Since you are using Visual Studio, you should look into Edit and Continue:
Edit and Continue is a time-saving feature that enables you to make
changes to your source code while your program is in break mode. When
you resume execution of the program by choosing an execution command
like Continue or Step, Edit and Continue automatically applies the
code changes with some limitations. This allows you to make changes to
your code during a debugging session, instead of having to stop,
recompile your entire program, and restart the debugging session.
But please pay attention to the limitations - Unsupported Scenarios, you might have to structure your code changes to fit within what's supported.