Here are some examples of how you would create a series plot, bar chart, pie chart, and band plot in a SAS Code node in Model Studio, using whatever data that you create or reference in the node in the &dm_lib library (just replace the name exampData with your name, and the actual data with the data you want to use).
/* SAS code */
data &dm_lib..exampData;
a = "a"; b = 2; c=1; d=3; x=3;
output;
a = "b"; b = 5; c=4; d=9; x=5;
output;
a = "c"; b = 4; c=2; d=5; x=10;
output;
run;
/* Series Plot */
%dmcas_report(dataset=exampData, reportType=SeriesPlot, x=a, y=b, description=%nrbquote(Series Plot), yref=3);
/* Bar Chart */
%dmcas_report(dataset=exampData, reportType=BarChart, category=a, response=b,description=%nrbquote(Bar Chart));
/* Bar Chart - sorted X-axis */
%dmcas_report(dataset=exampData, reportType=BarChart, category=a, response=b, sortBy=b, description=%nrbquote(Bar Chart - Sorted));
/* Pie Chart */
%dmcas_report(dataset=exampData, reportType=PieChart, category=a, response=b, description=%nrbquote(Segment Plot));
/* Band Plot */
%dmcas_report(dataset=exampData, reportType=BandPlot, x=x, y=b, limitLower=c, limitUpper=d, description=%nrbquote(Band Plot));
Here’s an example for creating a scatter plot of Residuals by Predicted in a SAS Code node following a Supervised Learning node for an interval target:
/* SAS code */
data &dm_lib..samp;
set &dm_data(obs=200);
Residual = Target - P_Target; /* substitute "Target" with the name of your target variable */
run;
%dmcas_report(dataset=samp, reportType=ScatterPlot, x=P_Target, y=Residual, description=%nrbquote(Scatter Plot), yref=0);
These code examples are also available from this GitHub repository.
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.
The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.