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

All,

 

A colleague is trying to create a graph based on input described below (dot language, see: https://en.wikipedia.org/wiki/DOT_(graph_description_language))

 

digraph {
rankdir=LR
DATA1_1 [shape = circle, style = filled, color = lavender]
DATA2_2 [shape = circle, style = filled, color = lavender]
DATA3_3 [shape = circle, style = filled, color = green]
DATA4_4 [shape = circle, style = filled, color = green]
script_1_5 [shape = diamond, style = filled, color = deepskyblue1]
script_2_6 [shape = diamond, style = filled, color = deepskyblue1]
script_1_5 -> DATA3_3
script_2_6 -> DATA4_4
DATA1_1 -> script_1_5
DATA2_2 -> script_1_5
DATA3_3 -> script_2_6
}

 

As a result I would like to create a graph like the one posted in the attached file. I something like this possible, could you give me some directions how to do this? 

 

Tnx. 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

> could you give me some directions how to do this

Here are some of the subtasks that you need to solve.

1. Decide whether you want to use the POLYGON and TEXT statements or whether you want to use pure annotation by using the SGANNO= option on the PROC SGPLOT statement. (I advise SGANNO, but either would work.)

2. Learn the basics of creating a graph using the method that you choose. (You might be able to skip this step if you are already proficient.)

3. Design a rectangular data set that captures the structure of the graph. Come up with good names for the variables. Learn to create the graph when the information is in a SAS data set with the known structure.

4. Learn how to scan the input strings and find the information that you need for the structure. This step might be hard if you expect your program to automatically layout the shapes. 

5. From (4), write out a SAS data set in (3) that matches the format you designed. They use (2) to render the graph.

 

Depending on your current knowledge and how many hours a day you work at it, it might take you a few weeks to create a prototype.  Good luck!

 

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

Can you clarify your request? Do you want to

1. Use SAS to create the graph in your PDF file, or

2. Use SAS to read the text strings that describe an arbitrarily complicated graph in the DOT format, parse the strings, figure out how to layout the graph, and then render the graph.

 

The first is straightforward, assuming that you are willing to manually specify the coordinates of the shapes. The second is a complicated research project that will require a lot of work.

Tjebbe
Fluorite | Level 6
Well let's start in the middle. Read the given text strings, parse them and create a similar graph like the one in the pdf. That would be helpfull.
The generalisation might be a next step but is out of scope for this question.
Rick_SAS
SAS Super FREQ

> could you give me some directions how to do this

Here are some of the subtasks that you need to solve.

1. Decide whether you want to use the POLYGON and TEXT statements or whether you want to use pure annotation by using the SGANNO= option on the PROC SGPLOT statement. (I advise SGANNO, but either would work.)

2. Learn the basics of creating a graph using the method that you choose. (You might be able to skip this step if you are already proficient.)

3. Design a rectangular data set that captures the structure of the graph. Come up with good names for the variables. Learn to create the graph when the information is in a SAS data set with the known structure.

4. Learn how to scan the input strings and find the information that you need for the structure. This step might be hard if you expect your program to automatically layout the shapes. 

5. From (4), write out a SAS data set in (3) that matches the format you designed. They use (2) to render the graph.

 

Depending on your current knowledge and how many hours a day you work at it, it might take you a few weeks to create a prototype.  Good luck!

 

ballardw
Super User

@Tjebbe wrote:
Well let's start in the middle. Read the given text strings, parse them and create a similar graph like the one in the pdf. That would be helpfull.
The generalisation might be a next step but is out of scope for this question.

Please look in the SAS documentation for the %sganno macro and related.

There are a number of macro statements that help to create an annotate data set which contains instructions for SAS SG graphics procedures to use.

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=grstatproc&docsetTarget=n...

 

These may be closest to the example you show to create similar graphic objects.

 

The SAS color naming conventions are multiple, flexible and sometimes a tad esoteric as to which common color names like "lavendar" may be supported. So if using such names you will need to investigate that as well as I doubt "deepskyblue1" is one of the accepted names.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1053 views
  • 4 likes
  • 3 in conversation