SAS plotter
- Package: SASPlotter
- Version: 1.3
- Generated: 2024-07-12T18:23:01
- Author(s): SupermanJP ([email protected])
- Maintainer(s): SupermanJP ([email protected])
- License: MIT
- File SHA256:
F*75B6D2048D2B62BA0CC63B342A43E2A59DE86A98E9E66C26CFFD9DA48621A058
for this version - Content SHA256:
C*4B673CC815673DF9FD89ECFDA87128B716AF9BDF9E60AA8035B2EA6357A55A0F
for this version
The data visualization method widely used at present lacks information on the distribution pattern hidden in the raw data, and has a drawback that it is difficult to judge whether the sample distribution assumption, which is the premise of the hypothesis test, is correct.
In recent years, new data visualization methods that overcome such drawbacks have been announced and are already available in open source languages such as R and python.
In contrast, the SAS language has made little effort as seen in open source languages.
"SAS Plotter" is modern graph suite for SAS. You can easily create advanced graphs for journals with little knowledge of SAS GTL (Graph Template Language) or sgplot procedures.
the lengthens data format is suitable.
This package use SAS Packages Framework.
for more information:
https://github.com/yabwon/SAS_PACKAGES
filename packages "<your path>";
filename SPFinit
url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit;
%installPackage(SPFinit);
%installpackage(sasplotter)
%loadpackage(sasplotter)
If you want to check the details of the parameters, output example and definitions, please refer to the following documents.
https://superman-jp.github.io/SAS_Plotter/
Required SAS Components:
- Base SAS Software
SAS package generated by SAS Package Framework, version 20240711
The SASPlotter
package consists of the following content:
Macro for two dimensional kernel density estimation (2D-KDE) plot using SAS GRAPH.
2D-KDE will show as contour plot with marginal KDE curve
group name should not be include "$". This character is the delimiter for this macro.
%macro kde2d(
data=,
x=,
y=,
group=None,
xlabel=x,
ylabel=y,
univar_grid=401,
bw_method=sjpi,
bw_adjust=1,
univar_style=line,
bivar_grid=60,
bivar_nlevel=10,
bivar_style=line,
thresh=0,
legend=true,
legendtitle=,
scatter=false,
rug=false,
palette=sns,
note=,
deletedata=true
);
Macro for Mirrored histogram using SAS GRAPH.
Mirrored histogram shows the distribution of response variable two groups. Histogram of the group which level is 2 will be inverted.
%macro MirroredHist(
data =,
group =,
x =,
y =,
xticks = None,
yticks = None,
xaxistype = discrete,
xlabel = x,
ylabel = y,
ytickfmt = 09.9,
orient = v,
legend = true,
barwidth = 1,
outline = true,
palette = sns,
note=,
deletedata = true
);
multihitogram is histogram created by each category variable and pair variable. Box width of histogram is reflect the response variable. multihistogram is used for frequency comparison of multiple category in small display area.
This macro was designed based on the report of Wierenga, Madison R et al. [1]
[1]Running CA Wierenga MR, Crawford CR.
Older us adults like sweetened colas, but not other chemesthetic beverages. 2020.
URL: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8140601/.
%multihistogram(
data=,
category=,
pair=none,
level=,
levelfmt=#,
response=,
cattitle=#,
leveltitle=#,
pairtitle=#,
responsetxt=false,
orient=v,
pairsplit=false,
legend=true,
palette=sns,
note=,
deletedata=true
);
Raincloud plot is contained density plot (half-violin plot) , box plot and strip plot.
density plot displays distribution estimated by KDE (kernel density estimation) of input data.
box plot displays descriptive statistics (mean, q1, q2, q3 outlier).
strip plot is jittered scatterplot and displays individual data.
%macro RainCloud(
data=,
x=,
y=,
group=None,
yticks=None,
xlabel=x,
ylabel=y,
cat_iv=2.5,
element_iv=0.02,
scale=area,
trim=True,
connect=false,
gridsize=401,
bw_method=sjpi,
bw_adjust=1,
orient=v,
legend=false,
legendtitle=#,
jitterwidth=0.1,
outlinewidth=1,
palette=sns,
note=,
deletedata=true);
this macro is useful for display raincloud plot of repeated measure study. number of replicate should be two.
the density plot of the second replicate is flipped horizontal.
spaghetti plot (individual tracings for each subject ) can be overlaid on the raincloud plot.
%macro RainCloudPaired(
data=,
x=,
y=,
repeat=,
subject=,
group=None,
yticks=,
ylabel=y,
cat_iv=1.6,
element_iv=0.4,
connect=False,
spaghetti=True,
scale=area,
trim=True,
gridsize=401,
bw_method=sjpi,
bw_adjust=1,
orient=v,
legend=false,
jitterwidth=0.05,
outlinewidth=1,
palette=sns,
note=,
deletedata=true);
Ridgeline plot shows the distribution of response variable each groups. The distribution is estimated by KDE (Kernel Density Estimation) using proc kde.
rugplot and several descriptive statistics (mean, q1, q2, q3) can be overlaid on the ridgeline plot.
%macro ridgeline(
data=,
x=,
y=,
group=None,
xlabel=x,
ylabel=y,
yticks=,
cat_iv = 1.2,
gridsize = 401,
bw_method = sjpi,
bw_adjust = 1,
quartile=False,
mean=False,
legend = False,
grouplegendtitle=group,
rug = False,
ruglength = 2,
fillstyle=None,
qgradient=1,
palette=sns,
note=,
deletedata=true);
To be more precise, it is called alluvial Diagram.
A Sankey diagram is a visualization used to depict a flow from one domain of values to another domain. Sankey graphs is useful for showing flow and relationships among multiple categories.
In pharmacoepidemiology study, this diagram is used for changes of the state of a patient over time, such as medication switching, disease stage progression, or movement through treatment pathways.
in this macro, statistics display and node focus are available.
%macro sankey(
data=,
domain=,
domainfmt=,
domaintextattrs=(color=black size=11),
gap=5,
nodefmt=auto,
nodewidth=0.2,
nodeattrs=auto,
nodename=true,
nodetextattrs=(color=black size=9),
linktext=true,
linktext_offset=0.05,
linkattrs=auto,
linktextattrs=(color=black size=8),
smooth=0.1,
focus=None,
stat=both,
unit=,
reverse=false,
endFollowup=None,
legend=false,
palette=sns,
note=,
deletedata=true
);
Copyright (c) since 2024 SupermanJP ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.