SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
Josers18
Obsidian | Level 7

Hey guys,

I am rather new at the program aspect of SAS and I have a program in the middle of my workflow which adds a new column to the data set

data WORK.FinalReport;

set WORK.FinalReport;

AffectedAccounts = dif(NbrOfAccts);

RunningTotal = lag(NbrOfAccts);

run;

However, I always have the issue that when I run the project the program always runs early on.. much earlier than the dataset that it needs to update.

My question is, is there a way to delay or make the program wait or run conditionally after the query that creates the work.finalreport data has run?

Any help would be appreciated..

Running EG 5.1

7 REPLIES 7
Reeza
Super User

You need to add it in to your process flow at the correct point. 

You can right click the program and "draw" the connections to insert the program at the correct point. You may need to "break" your current process flow to get it inserted at the appropriate point.

Josers18
Obsidian | Level 7

I mean the program itself displays as if it were in the correct location, but it just runs in the beginning of my flow..

See image ("Program"), when I execute the flow, it lights up right away and runs rather quickly way before the "Final Report" query has run

Sas Sample.png

Haikuo
Onyx | Level 15

"lights up " only means it is in the "active" queue, it still runs follow the flow. If this is your only proof, then you don't have a case here. Have you actually checked the project log and there are signs to support your conclusion?

Haikuo

Josers18
Obsidian | Level 7

What I meant is that it lights up, then completes early into the process much before the other query completes which results in the following:

By this time, the program has already executed, as you can see much before the Final Report query

Sas Sample 2.png

Resulting in this:

Sas Sample 3.png

Haikuo
Onyx | Level 15

I see. So if you want Query Builder "Final Report" to finish first before launching of the "program", then it should be look like this:

Capture.PNG

Then after your first run, you may find a table element inserted between the query and your program. Have I understood you correctly?

Josers18
Obsidian | Level 7

Yes! that is correct.. looks about right.

Reeza
Super User

One way to more easily detect errors like this is to not rename the table to have the same name. If you give it a new name and make sure the next process uses the new table name it becomes easier to make sure things are in the right place .

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2216 views
  • 1 like
  • 3 in conversation