BookmarkSubscribeRSS Feed
Calcite | Level 5

Hello everyone, 

I am doing group based trajectory modeling by SAS PROC TRAJ.

I need help in graphing. There was code below.

The attached picture which was colorful is the one drawn by PROC TRAJ. The other one without color is my goal. Therefore, I hope to change its legend, color and also thelso  legend on the line. Besides, I awant to change the x-axis to start from 1998 not 1995. Can anybody help! 


*/Main code*/

PROC traj DATA=work OUT=of outstat=os outplot=op outest=oe ;

ID id;

VAR bmi9-bmi15;

INDEP yr1-yr7;

Max 1000;


ngroups 4 ;

order 1 1 1 1 ;


*/Drawing function*/

%trajplot (OP, OS, "Female >60, 4 group ", "linear", "BMI", "7-Consecutive");

Fluorite | Level 6

The plots in %trajplot are helpful, quick displays but when I need to customize graphs, I use the output in the saved plot datasets and then use proc sgplot to customize what is needed. For example, if you only want the 'predicted' lines, the example below shows you set up each group as a series. You can similarly include the observed averages on the same graph and change the line style.... 


proc sgplot data=plot_MME;
title 'Predicted MME';
series x=month Y=predmme1;
series x=month Y=predmme2;
series x=month Y=predmme3;
series x=month Y=predmme4;
* Yaxis values=(0 to 375) label='Predicted MME';
label predmme1='Group 1 Pred'
predmme2='Group 2 Pred'
predmme3='Group 3 Pred'
predmme4='Group 4 Pred'

Calcite | Level 5

Hello Everyone,


In the image below (Output of Proc traj) there is difference in the two "N's". Can any one please explain the reason.





Thanks and Regards


Calcite | Level 5

Hi Vishnu,

The first N which is usually larger represents all the data points in your data, while the second N represents the unique observations (subjects) in the data.


So, if you have 10 unique persons and each of them them have 4 complete data points, the first N will be 40 while the second N will be 10.


I most cases, due to dropout or missing data, the first N is usually not a direct multiplication of the second.


Hope this helps. Sorry if it came late. It might be helpful for someone else.





Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 4 in conversation