BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yura2301
Quartz | Level 8

Hi all,

Would like to ask if there is some tech. possibility to create tasks in SAS EG(Version 7.15 HF3) like "on fly", dinamically.

For example, let's assume there is SAS EG project with only one SAS code(program). The SAS code has macro/data steps etc. , and when the user run that SAS program - should be created a few new SAS programs with some concrete names and some content(comments,code etc.) in same EG project below the initial SAS code.

Important to create exactly SAS program, not output data set(that's no problem to output multiply tables from one SAS program).

In ideal case I would like to dynamically build set of related SAS programs, linked between each other, that will looks like:

Yura2301_0-1642766656056.png

 

 

Thanks in adwanced for any advices!

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

If you would like to write a script (using VB Script or PowerShell) to generate a project that has one or more SAS programs, that is possible. See Doing More with SAS Enterprise Guide Automation for explanation and examples.

 

While the object model for scripting does allow you to add programs "on the fly", you won't be able to establish linked relationships among them. That is supported only in the user interface.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

View solution in original post

6 REPLIES 6
SASKiwi
PROC Star

SAS macro is a code and program generator. It all depends on what you want it to do. Have a look at some of the macro examples posted on the Community.

Yura2301
Quartz | Level 8

Hi SASKiwi,

Thanks for the reply, but will maybe need to describe the case a bit more in detail.

So I complitely agree  -we can create any looping and dynamicaly create any SAS code, but what I need is a bit different - I would like to create separate SAS codes inside of SAS EG project, for example, initiall EG project can looks like:

Yura2301_0-1642760579480.png

Yura2301_1-1642759475004.png

Inside of that SAS code I'm planning to do some macro-looping etc., and then according all the logic(if then else etc.) - a few additional SAS programs should occur in the EG project, like that:

Yura2301_2-1642759590489.png

I know for sure that I can generate those codes like .sas files on some shared drive and then open them manually in SAS EG, but I would like to skip that manual step and automate that part, so Code_1, Code_2 and Code_3 will be created automatically in SAS EG project.

 What is even more preferable - dynamically creates links(arrows) between SAS programs:

Yura2301_1-1642760619824.png

 

So final results should be like in initial post(set of linked tasks , created and connected(linked) using some sas macro language or maybe EG own features):

Yura2301_1-1642766718882.png

 

 

 

Thanks one more time for support!

 

ChrisHemedinger
Community Manager

If you would like to write a script (using VB Script or PowerShell) to generate a project that has one or more SAS programs, that is possible. See Doing More with SAS Enterprise Guide Automation for explanation and examples.

 

While the object model for scripting does allow you to add programs "on the fly", you won't be able to establish linked relationships among them. That is supported only in the user interface.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Yura2301
Quartz | Level 8

Hi Chris,
Thanks for the explanation!
So just to be sure:
1.Using some scripting languge (like PowerShell) - it's doable to create EG project with needed number of SAS programs.
2.It's not possible link SAS programs between each other using SAS macro etc., am I right?

Just would like to clarify one more related point, maybe another but a bit similar scenario -if one code generates a few dataset, one base on another, can it somehowe maybe possible to visualize that dependency in SAS EG:

Yura2301_0-1642769947948.png

 

So in Sas code "Macro" was created Test1 table, and then I manually using wizard add filter after it, so it's visible now that there are two steps.

So the question is - is it possible add 2 steps into first "Macro" sas code but EG somehow will show that second output was made from the first one(by link or arrow).

Based on your last explanations it's probably not possible, but maybe there is some workaround.

 

Thanks one more tiome for support!

 

ChrisHemedinger
Community Manager

Hi @Yura2301,

 

Using the automation model it's not possible to make those dependencies show in the flow. The only "task" you can create dynamically is the Code (program) task, and while it may show output data when it runs, another Code node won't show an input data with a link pointing in. You can add that link manually in the UI, but not via script. 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Yura2301
Quartz | Level 8

Hi Chris,
Thanks for quick and proffessional answers!
Have a nice weekend!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 784 views
  • 1 like
  • 3 in conversation