BookmarkSubscribeRSS Feed
SupermanJP
Obsidian | Level 7

Hi. I'm SupermanJP.

 

I updated SAS plotter,  modern data visualization package for SAS base.

https://github.com/Superman-jp/SAS_Plotter 

 

document

https://superman-jp.github.io/SAS_Plotter/ 

 

new features

 

  •  new plots " sankey diagram" was available!

ezgif-2-7d9e0864f0.pngsankey_basic+(1).png
official mail address: sasplotter@picolabs.jp
official web site (Japanese) https://picolabs.jp
Please feel free to contact me if you have any bug reports, feedback, or requests.

10 REPLIES 10
t75wez1
Pyrite | Level 9

Hello SupermanJP,

Nice work!

How to get your input data set named "raw" to your code?

Thanks,  

SupermanJP
Obsidian | Level 7

I apologize for the lack of clarity. i will revise the document.

 

"raw" dataset means input data you want to make sankey.

 

if you want to sankey using this macro, prepare the input data with structure.

SupermanJP_0-1718067631371.png

 

 

t75wez1
Pyrite | Level 9

Sorry I mean to find the SAS data set named "raw" in your SAS code to replicate the graph here.

Thanks,

SupermanJP
Obsidian | Level 7
the "raw" dataset is not included in SAS plotter package. sorry. I will add the raw dataset at next version.
GraphGuy
Meteorite | Level 14

Examples are a *lot* more useful, when they include the sample data!

SupermanJP
Obsidian | Level 7
OK
SupermanJP
Obsidian | Level 7
if you have additional idea, Please feel free to contact me.

by the way, you are so handsome.
yabwon
Onyx | Level 15

Raw data should look like in this example this:

data raw;
subjID+1;
input day0 day30 day60 day120;
cards;
0 2 3 4
0 2 3 4
0 2 3 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 4 3
4 3 2 1
4 3 2 1
4 3 2 1
4 3 2 1
;
run;

Basically each row (each subjid) indicates which drug was taken by a given patient during given time, e.g.

If patient 1 took drug 0 on the day 0, then drug 2 on the day 30, drug 3 on the day 60 and drug4 on day 120, the observation will be:

data raw;
input subjID day0 day30 day60 day120;
cards;
1 0 2 3 4
;
run;

Result of the following snippet:

proc format;
value domainf
1="day0"
2="day30"
3="day60"
4="day120";

value nodef
0="Drug A"
1="Drug B"
2="Drug C"
3="Drug D"
4="Drug E"
;
run;


data raw;
subjID+1;
input day0 day30 day60 day120;
format day0 day30 day60 day120 nodef.;
cards;
0 2 3 4
0 2 3 4
0 2 3 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 2 4
2 1 4 3
4 3 2 1
4 3 2 1
4 3 2 1
4 3 2 1
;
run;

ods graphics / height=15cm width=20cm imagefmt=svg imagename="sankey_basic" noborder;
ods listing gpath="R:\";
ods html;
%sankey(
    data=raw,
    domain=day0 day30 day60 day120,
    domainfmt=domainf
);

looks like this:

yabwon_0-1718780403630.png

 

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



yabwon
Onyx | Level 15

One more example:

data raw;
  call streaminit(123);
  do subjID = 1 to 1000;
    array A day0 day30 day60 day120;
    format day0 day30 day60 day120 nodef.;
      do over A;
        A = rand('integer',0,4);
      end;
    output;
  end;
run;

which, with the same snippet,  produces this:

yabwon_0-1718781741110.png

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



SupermanJP
Obsidian | Level 7
Thanks. Very informative.

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
  • 10 replies
  • 796 views
  • 13 likes
  • 4 in conversation