New Contributor
Posts: 2

# how to create a 2d scatter plot using two data sets

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

Posts: 5,543

## Re: how to create a 2d scatter plot using two data sets

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
Super Contributor
Posts: 320

## Re: how to create a 2d scatter plot using two data sets

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?

New Contributor
Posts: 2

## Re: how to create a 2d scatter plot using two data sets

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.

Super Contributor
Posts: 320

## Re: how to create a 2d scatter plot using two data sets

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.

Super Contributor
Posts: 320