Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- how to create a 2d scatter plot using two data set...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-11-2013 02:01 PM

I need to create a 2D scatter plot using two data sets. Both data sets contain the same variables (x1, x2, x3, x4, x5, x6). Not sure how to do this.

I also need to create a 3d scatter plot again using both data sets but this time with just 3 of the variables (x4, x5, x6).

Any pointers on how to do this would be greatly appreciated!

Thank you,

M

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-11-2013 02:49 PM

SAS plotting procedures require a single input dataset. So, you will need to combine your two datasets somehow. Exactly how depends on your precise requirements. Please provide more details.

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-11-2013 02:49 PM

You don't really give us much to go on, do you? What's the significance of the second data set? What are you graphing - what's your x/y variables?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-11-2013 03:00 PM

This is for a course I am taking and unfortunately, I have not been given much more information than what I have provided. I was given a .txt file with 200 observations and 6 variables (x1,x2,x3,x4,x5,x6). The instructions say to split the data set. The first 100 observations represent 1 set of measurements (genuine banknotes (XT)) the 2nd 100 observations represent (counterfeit banknotes (XF)). The second set of instructions say to construct a 2D scatter plot for XT vs XF of the bank notes. That is all the instructions I have. Sorry for the lack of info.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-11-2013 03:20 PM

Sounds like x1-x6 are six data points where genuine and counterfeit banknotes might have differences.

Assuming you're taking the PSU course here, or one with a similar dataset, you need to input swiss3.txt, or set the two datasets together, with a new variable 'real' or 'fake' which differentiates which dataset they came from.

Then you could run any number of comparisons. Here's one example.

proc sgscatter data=banknotes;

matrix x1-x6/group=type;

run;

A scatterplot matrix is a great way to see how variables interrelate. You could use this in theory to identify which combinations of variables give you the best way to tell which note is fake or real.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-11-2013 03:30 PM

Also, to answer your second question, look at PROC G3D for 3d scatterplots. It's not an ODS Graphics procedure, so it won't necessarily work the same as SGSCATTER, but it is the only way I know of to do a 3d scatter plot. You should use the Real vs Fake to determine the shape (look at the shape option on the scatter statement, using a variable to determine it).