I am trying to produce a plot
below is example data
histo treatment subjid tspd pct_chg
1 G-CHP 1001 100 -98
Ii need to generate a plot by histo and all treatments in oneplot
Code:
proc gplot data = &ds.;
plot pct_chg * tspd = subjid/ des = "Non-DLBCL" vaxis=axis1 haxis=axis2 noframe nolegend ;
Ques:
in tspd i have values from 0 to 1000 and I have 7 treatment arms.
when I am ploting for some treatments if tspd > 400 they are not showing in the graph but they are in the dataset.
So can you please guide.Greatly appreciated help..
Regards
Show the definition of AXIS2. When you use haxis=axis2 then the defintion if you include and ORDER or something controlling tickmarks and displayed values may truncate the displayed values. For instance if AXIS2 includes something like Order=(0 to 400 by 50) it would not display any values greater than 400 on that axis.
axis1 label = (a=90 f=arial h=2.2 "% Change of Tumor from Baseline")
value = (h=1.5)
style = 1
width = 5
color = black
offset = (1 cm, 1 cm)
order = (-100 to 25 by 25)
major = (h=0.5 w=6);
axis2 label = (f=arial h= 2.2 "TIME (days)")
value = (h=1.5)
style = 1
width = 5
color = black
offset = (1 cm, 1 cm)
order = (0 to 1000 by 200)
major = (h=0.5 w=6)
minor=none
;
proc sql noprint;
create table all1 as
select histo,trtg,atrt, count(unique(subjid)) as ntrt from all
group by histo,trtg,atrt;
select ntrt into:ntrt11 from all1
where atrt = 3001 and histo=1;
select ntrt into:ntrt12 from all1
where atrt = 3002 and histo=1;
select ntrt into:ntrt13 from all1
where atrt = 3003 and histo=1;
select ntrt into:ntrt14 from all1
where atrt = 3004 and histo=1;
select ntrt into:ntrt15 from all1
where atrt = 3005 and histo=1;
select ntrt into:ntrt16 from all1
where atrt = 3006 and histo=1;
select ntrt into:ntrt17 from all1
where atrt = 3007 and histo=1;
select ntrt into:ntrt53 from all1
where atrt = 3003 and histo=5;
select ntrt into:ntrt54 from all1
where atrt = 3004 and histo=5;
select ntrt into:ntrt55 from all1
where atrt = 3005 and histo=5;
select ntrt into:ntrt57 from all1
where atrt = 3007 and histo=5;
quit;
proc sort data = &ds. ;
by atrt subjid tspd;
run;
%if &hist = 1 %then %do;
%macro B11;
%do J = 1 %to 9;
symbol&J i=join v=circle w=2 l=1 h=1 color=green;
%end;
%mend B11;
%macro B12;
%do J = 10 %to 47;
symbol&j i=join v=circle w=2 l=1 h=1 color=RED;
%end;
%mend B12;
%macro B13;
%do j = 48 %to 51;
symbol&j i=join v=circle w=2 l=1 h=1 color=BLUE;
%end;
%mend B13;
%macro B14;
%do J = 52 %to 55;
symbol&J i=join v=circle w=2 l=1 h=1 color=BLACK;
%end;
%mend B14;
%macro B15;
%do J = 56 %to 57;
symbol&j i=join v=circle w=2 l=1 h=1 color=ORANGE;
%end;
%mend B15;
%macro B16;
%do j = 58 %to 60;
symbol&j i=join v=circle w=2 l=1 h=1 color=BROWN;
%end;
%mend B16;
%macro B17;
%do j = 61 %to 65;
symbol&j i=join v=square w=4 l=1 h=4 color=purple;
%end;
%mend B17;
%B11;
%B12;
%B13;
%B14;
%B15;
%B16;
%B17;
%end;
%if &hist = 5 %then %do;
%macro B53;
%do j = 1 %to 2;
symbol&j i=join v=circle w=2 l=1 h=1 color=BLUE;
%end;
%mend B53;
%macro B54;
%do j = 3 %to 4;
symbol&j i=join v=circle w=2 l=1 h=1 color=BLACK;
%end;
%mend B54;
%macro B55;
%do j = 5 %to 5;
symbol&j i=join v=circle w=2 l=1 h=1 color=ORANGE;
%end;
%mend B55;
%macro B57;
%do j = 6 %to 6;
symbol&j i=join v=circle w=2 l=1 h=1 color=purple;
%end;
%mend B57;
%B53;
%B54;
%B55;;
%B57;;
%end;
%if &hist = 1 %then %do;
proc gplot data = &ds.;
plot pct_chg * tspd = subjid/ des = "DLBCL" vaxis=axis1 haxis=axis2 noframe nolegend ;
%end;
%else %if &hist = 5 %then %do;
proc gplot data = &ds.;
plot pct_chg * tspd = subjid/ des = "Non-DLBCL" vaxis=axis1 haxis=axis2 noframe nolegend ;
%end;
run;
quit;
%mend plot;
%plot(hist=1,d=1,ds=all_dl);
%plot(hist=5,d=1,ds=all_fl);
%plot(hist=1,d=2,ds=all_dl);
ods pdf close;
ods listing;
Attached my code..Appreciate your help
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.