I'm working with the SAS University Edition, and I'm having trouble creating a scatter plot from a dataset with three X variables. It seems like this should be really simple, but I can only seem to add one X value. I have a homework assignment where my instructor asked us to "Plot the observed data and the two fitted regressions on one plot (this is probably easiest done by hand over a scatterplot of the data)." Here is the data set:
Obs | CITY | Y | X1 | X2 | X3 |
1 | 1 | 11.2 | 587 | 16.5 | 6.2 |
2 | 2 | 13.4 | 643 | 20.5 | 6.4 |
3 | 3 | 40.7 | 635 | 26.3 | 9.3 |
4 | 4 | 5.3 | 692 | 16.5 | 5.3 |
5 | 5 | 24.8 | 1248 | 19.2 | 7.3 |
6 | 6 | 12.7 | 643 | 16.5 | 5.9 |
7 | 7 | 20.9 | 1964 | 20.2 | 6.4 |
8 | 8 | 35.7 | 1531 | 21.3 | 7.6 |
9 | 9 | 8.7 | 713 | 17.2 | 4.9 |
10 | 10 | 9.6 | 749 | 14.3 | 6.4 |
11 | 11 | 14.5 | 7895 | 18.1 | 6 |
12 | 12 | 26.9 | 762 | 23.1 | 7.4 |
13 | 13 | 15.7 | 2793 | 19.1 | 5.8 |
14 | 14 | 36.2 | 741 | 24.7 | 8.6 |
15 | 15 | 18.1 | 625 | 18.6 | 6.5 |
16 | 16 | 28.9 | 854 | 24.9 | 8.3 |
17 | 17 | 14.9 | 716 | 17.9 | 6.7 |
18 | 18 | 25.8 | 921 | 22.4 | 8.6 |
19 | 19 | 21.7 | 595 | 20.2 | 8.4 |
20 | 20 | 25.7 | 3353 | 16.9 | 6.7 |
Can you provide an example of what such a plot would look like?
I don't think so, because I'm not even sure what it would look like myself... unless my instructor means I should create a separate scatterplot for each X variable?
I think he's asking us to do something like what's being done in this video using a different program... https://www.youtube.com/watch?v=_5kRBBqQhA0
PROC SGSCATTER will create such a scatterplot with 3 x-variables and one-y variable. An example is given here:
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.