BookmarkSubscribeRSS Feed
Victor_Chiu
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;

MODEL CNORM;

ngroups 4 ;

order 1 1 1 1 ;

RUN;

*/Drawing function*/

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

3 REPLIES 3
sshetter
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'
run;

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

 

Vishnu_Vivek_0-1687773404712.png

 

 

Thanks and Regards

Vishnu 

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

 

Bon

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 3334 views
  • 2 likes
  • 4 in conversation