From the course: SAS Programming for R Users, Part 2

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Demo: Creating standard R plots

Demo: Creating standard R plots - SAS Tutorial

From the course: SAS Programming for R Users, Part 2

Demo: Creating standard R plots

- [Instructor] In this demonstration, I want to reproduce the basic R plotting capabilities all in sgplot. So first, I'm going to generate some histogram data. I'll set a seed of one, two, three. And I'm going to simulate 1,000 observations. My variable x will be exponentially distributed with a mean of 10. So I'll just multiply every value by a value of 10. And once I create that data, I'm going to use proc sgplot in the histogram's statement to create a histogram. And I'll run the first data and proc step. So of course, our distribution is skewed, because we simulated from an exponential distribution. Let's go ahead and create the histogram distribution again. This time as an option. I'm going to change the binwidth to a value of one. And to overlay a density estimate, I'll use the density statement and specify my variable x. And as options, I can say type equal to normal and type equal to kernel, so I'm overlaying two different density estimates here. So again, I've combined…

Contents