BookmarkSubscribeRSS Feed
Sean_OConnor
Fluorite | Level 6

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;     
3 REPLIES 3
Rick_SAS
SAS Super FREQ

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; 

 

Sean_OConnor
Fluorite | Level 6

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;
Rick_SAS
SAS Super FREQ

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?  

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1500 views
  • 0 likes
  • 2 in conversation