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.
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.