Calcite | Level 5

## How to plot certain values in SAS

Hi,

How to plot the graph for only 50 and 75 and rest of the values should not be ploted.And 50 and 75 are different colors.

Please find the attached document for the query and data like

 0.249377 5.17532 0.623441 10.3494 1.1222 15.3048 1.74564 20.1719 2.53533 25.0603 3.53283 30.1184 4.65503 35.0611 5.98504 40.0206 7.56442 45.0366 9.47631 50.0665 11.7207 55.0245 14.4223 60.0602 17.5811 65.0406 21.2801 70.034 25.6858 75.0302 30.9643 80.0342 37.739 85.0182 47.0075 90.0126 61.0141 95.0102 100 100

Thanks and regards

4 REPLIES 4
Super User

## Re: sas

Use either SGPLOT with a WHERE clause and filter it for values 50/75

Your values don't have whole values of 50 or 75 so in the context of Your question it doesn't make sense.

Calcite | Level 5

## Re: sas

for example i have two variables

1) percentages_agents

i have the values like

 0.249377 5.17532 0.623441 10.3494 1.1222 15.3048 1.74564 20.1719 2.53533 25.0603 3.53283 30.1184 4.65503 35.0611 5.98504 40.0206 7.56442 45.0366 9.47631 50.0665 11.7207 55.0245 14.4223 60.0602 17.5811 65.0406 21.2801 70.034 25.6858 75.0302 30.9643 80.0342 37.739 85.0182 47.0075 90.0126 61.0141 95.0102 100 100

then i have to highlite only 50,75 values of percentages_premium rest of the values should not be plotted.

i have done

symbol value=squarefilled color=vibg cv=vibg interpol=join;
proc gplot data=annexus.annexus_2016a_group_final1_per;
plot cpp*cap/
haxis=0 to 100 by 10
vaxis=0 to 100 by 25
vminor=0
hminor=0
regeqn;
run;
quit;

Diamond | Level 26

## Re: How to plot certain values in SAS

Post test data in the form of a datastep.  Don't post attachments like docx/xlsx as these are dangerous and wont be donwloaded.  As for your problem,

where int(value) in (50,70);

Can be added to code to have only those values whose whole part is 50 or 70.

SAS Super FREQ

## Re: How to plot certain values in SAS

hi

As re Reeza suggested I would go for Proc SGPLOT, find below some sample code that can get you started.

``````data have;
infile cards dlm=",";
input x y;
cards;
0.249377,5.175325
0.623441,10.3494
1.122195,15.30481
1.745636,20.17191
2.535328,25.06026
3.532835,30.11836
4.655029,35.0611
5.985037,40.02055
7.564422,45.03658
9.476309,50.06652
11.7207,55.02452
14.42228,60.06016
17.58105,65.04058
21.28013,70.03401
25.68579,75.03019
30.96426,80.03419
37.73899,85.0182
47.00748,90.01258
61.01413,95.01025
100,100
;

data have2;
set have;

if int(y) = 50 then do;
x2 = x;
y2 = y;
group=1;
end;

if int(y) = 75 then do;
x2 = x;
y2 = y;
group=2;
end;

if 50 <= int(y) <= 75 then do;
x3 = x;
y3 = y;
end;
run;

proc sgplot data=have2 noautolegend;
styleattrs
datasymbols=(DiamondFilled)
datacontrastcolors=(red green)

;
series x=x y=y ;
scatter x=x2 y=y2 / group=group  markerattrs=(size=20)  ;
run;

proc sgplot data=have2 noautolegend;
series x=x y=y /;
series x=x3 y=y3 / lineattrs=(THICKNESS=5);
refline 50 75;
run;``````

Bruno

Discussion stats
• 4 replies
• 1753 views
• 0 likes
• 4 in conversation