Date: Thu, 18 Dec 2008 08:17:59 -0800
Reply-To: "Pardee, Roy" <pardee.r@GHC.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Pardee, Roy" <pardee.r@GHC.ORG>
Subject: Re: How to distinguish variables on a scatter plot
In-Reply-To: <d051b19c-84ae-4446-941d-6bc5fefe1654@j39g2000yqn.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
I don't think base sas' PLOT will do color. You can cause sas to use different plot symbols for males & females though, like so:
plot tlc*height = sex ;
If you've got sas/graph licensed you can get color with proc GPLOT. Use that same plot statement & you'll get different colors/symbols for males & females.
HTH,
-Roy
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Paul Lambson
Sent: Wednesday, December 17, 2008 11:17 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: How to distinguish variables on a scatter plot
I am trying to use a scatter plot graph and use two make the variables different colors. In this example I would like the female and the male observations to be different. Any help on this would be great.
Thanks,
Paul
proc format;
value sex
0='Females'
1='Males'
;
run;
data lung;
input patient age sex height tlc;
format sex sex.;
label
patient='Patient ID number'
age='Age in years'
sex='Sex (0=female 1=male)'
height='Height (cm)'
tlc='Total lung capacity'
;
cards;
1 35 0 149 3.40
2 11 0 138 3.41
3 12 1 148 3.80
4 16 0 156 3.90
5 32 0 152 4.00
6 16 0 157 4.10
7 14 0 165 4.46
8 16 1 152 4.55
9 35 0 177 4.83
10 33 0 158 5.10
11 40 0 166 5.44
12 28 0 165 5.50
13 23 0 160 5.73
14 52 1 178 5.77
15 46 0 169 5.80
16 29 1 173 6.00
17 30 0 172 6.30
18 21 0 163 6.55
19 21 0 164 6.60
20 20 1 189 6.62
21 34 1 182 6.89
22 43 1 184 6.90
23 35 1 174 7.00
24 39 1 177 7.20
25 43 1 183 7.30
26 37 1 175 7.65
27 32 1 173 7.80
28 24 1 173 7.90
29 20 0 162 8.05
30 25 1 180 8.10
31 22 1 173 8.70
32 25 1 171 9.45
;
run;
proc plot data=lung;
title1 'Figure 1: Total lung capacity vs height';
title2 'Low-resolution plot using default options'; plot tlc*height; run; quit;