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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
The DO loop6m 18s
-
Random number generation3m 40s
-
Demo: The DO loop and random number generation5m 27s
-
Plotting with the SGPLOT procedure6m 55s
-
Demo: Creating standard R plots7m 12s
-
Enhancing the plot1m 47s
-
Demo: Enhancing the plot5m 43s
-
Multi-cell plotting procedures and statements6m 5s
-
Demo: Multi-cell plotting4m 33s
-
-