Folks,
I would like to create a visual aid for my data in order to help me understand outliers.
What I would like to do is compare values obtained from a survey with values from other sources to see if there is a mismatch and where.
I was thinking of creating a scatter plot and divding it into four sectors.
My X-axis would be survey values and Y would be Other values.
Therefore the top left would be low survey value high other value, top right high survey value, high admin value and so on.
I've seen such an example for proc gplot bubble graph but I can't seem to replicate it for a scatter graph. Could anyone provide some assitance please?
Here is some sample data for people to look at.
data sample;
input id $ 2. survey other;
datalines;
01 15000 65000
02 6500 6500
03 8426 10000
04 1650 16805
05 630 1500
06 110055 56812
07 24568 15200
08 6000 7800
;
run;
You don't mention how you intend to determine the cutoff values, but if you are looking at a regression context, you can look at the ROBUSTREG procedure, which automatically detects points of high-leverage and outliers. See the doc for the robust distance plot, which you can create as follows:
proc robustreg data=sample method=MM plots(only)=rdplot;
model other =survey;
run;
If you have your own method, you can use the REFLINE statement to add vertical and horizontal lines to your scatter plot:
proc sgplot data=sample;
scatter x=survey y=other;
refline 22400 / axis=x;
refline 20000 / axis=y;
run;
Rick when I try to run the following command I get the following error.
ods graphics on;
22 proc robustreg data=varsofimport method=MM plots(only)=rdplot;
ERROR: Library COMMON does not exist.
ERROR: Library COMMON does not exist.
WARNING: Unable to load prototypes from 'common.funcs'.
23 model nat_totinc =nat_totinc_admin;
24 run;
1. What version of SAS?
2. What SAS interface? (Enterprise Guide? SAS Studio? SAS University Edition?)
3. Can you run the Getting Started example in the ROBUSTREG documentation?
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.