my code is below: I have x axis values like in months such as D1 D28 2 3 4 6 12 18 24 36 but for one subject it is plotting month 18 after month 48 even though data is sorted properly by numeric variable.
title 'Percent Predicted FEV1 for Individual Subjects in Four 4D-710 Dose Cohorts';
proc sgplot data= combo;
xaxis grid type= discrete discreteorder= data;
series x = month y= RESTRESN/ group=subjid;
scatter x=month y= RESTRESN/ group= subjid ;
xaxis label= 'Month';
yaxis label= 'ppFEV1 (%)';
by cohort;
run;
Most likely because the value of 18 did not appear in the first BY group.
Try adding observations for every possible MONTH value that have a new COHORT value that will sort before the others.
@dsam wrote:
my code is below: I have x axis values like in months such as D1 D28 2 3 4 6 12 18 24 36 but for one subject it is plotting month 18 after month 48 even though data is sorted properly by numeric variable.
title 'Percent Predicted FEV1 for Individual Subjects in Four 4D-710 Dose Cohorts';
proc sgplot data= combo;
xaxis grid type= discrete discreteorder= data;
series x = month y= RESTRESN/ group=subjid;
scatter x=month y= RESTRESN/ group= subjid ;
xaxis label= 'Month';
yaxis label= 'ppFEV1 (%)';
by cohort;
run;
When you have multiple XAXIS statements, the second one replaces whatever is specified in the first.
Combine your two XAXIS statements into one statement since it appears the DISCRETEORDER= option is not being maintained.
title 'Percent Predicted FEV1 for Individual Subjects in Four 4D-710 Dose Cohorts';
proc sgplot data= combo;
xaxis grid type= discrete discreteorder= data label= 'Month';
series x = month y= RESTRESN/ group=subjid;
scatter x=month y= RESTRESN/ group= subjid ;
yaxis label= 'ppFEV1 (%)';
by cohort;
run;
Hope that helps.
Marcia
Dive into keynotes, announcements and breakthroughs on demand.
Explore Now →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.
Ready to level-up your skills? Choose your own adventure.