Help using Base SAS procedures

How to plot certain values in SAS

Reply
New Contributor
Posts: 2

How to plot certain values in SAS

[ Edited ]

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.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

 

Thanks and regards

 

 

Super User
Posts: 17,784

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. 

New Contributor
Posts: 2

Re: sas

for example i have two variables

1) percentages_agents

2)percentages_premium

 

i have the values like

0.2493775.175325
0.62344110.3494
1.12219515.30481
1.74563620.17191
2.53532825.06026
3.53283530.11836
4.65502935.0611
5.98503740.02055
7.56442245.03658
9.47630950.06652
11.720755.02452
14.4222860.06016
17.5810565.04058
21.2801370.03401
25.6857975.03019
30.9642680.03419
37.7389985.0182
47.0074890.01258
61.0141395.01025
100100

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;

 

please replay.

Super User
Super User
Posts: 7,395

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
Posts: 683

Re: How to plot certain values in SAS

[ Edited ]

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

Ask a Question
Discussion stats
  • 4 replies
  • 131 views
  • 0 likes
  • 4 in conversation