BookmarkSubscribeRSS Feed
ay05
Calcite | Level 5

hello everyone!, I want to revise the figure of the group-based trajectory models,  when I use the proc traj -plotnew fig1 was demonstrated, but i want to revise it into the figure like fig2.

 

ay05_0-1695692656396.png

                                                   fig1

 

revised version

ay05_2-1695691805472.png

                                                      fig2

my codes are as follows:

ODS GRAPHICS ON;
PROC TRAJ DATA=D1 OUT=P1 OUTSTAT=P2 OUTPLOT=P3 ITDETAIL;
ID ID;
VAR VAR1-VAR4; INDEP T1-T4;
MODEL CNORM; MAX 10;
NGROUPS 3;ORDER 3 3 3;
RUN;
DATA PLOT1;
SET D1;
ARRAY VV{*}VAR1-VAR4;
ARRAY TT{*}T1-T4;
DO I=1TO DIM(VV);
IDD=ID;
TIME=TT(I);
VALUE=VV(I);
OUTPUT;
END;
KEEP TIME VALUE IDD;
RUN;
PROC MEANS DATA=D1 N NMISS MEAN STDDEV STDERR MIN P25 MEDIAN P75 MAX QRANGE CLM;
VAR VAR1-VAR4 T1-T4;
RUN;
PROC SGPLOT DATA=PLOT1;
VBOX VALUE/GROUP=TIME;
RUN;
ODS HTML DPI=300;
PROC SGPLOT DATA=PLOT1;
VLINE TIME/RESPONSE=VALUE GROUP=IDD;
RUN;

%macro traj_M(DATA,ID,AVEPP,EST,PLOT,STAT,VAR,INDEP,NGROUPS,ORDER,TITLE);
PROC TRAJ DATA=&DATA. OUTPLOT=&PLOT. OUT=&AVEPP. OUTSTAT=&STAT. OUTEST=&EST. ITDETAIL CI95M;
ID &ID.;
VAR &VAR.;
INDEP &INDEP.;
MODEL CNORM;
MIN 0;
MAX 10;
NGROUPS &NGROUPS.;
ORDER &ORDER.;
RUN;
PROC SORT DATA=&AVEPP.;BY GROUP;
RUN;
ODS HTML DEI=300;
%TRAJPLOTNEW(&PLOT,&STAT,"ZBMI",'CNORM MODEL','BMI','TIME(MONTH)');
QUIT;
%MEND;
%LET DATA=D1;
%LET PREFIX=TEST_;
%LET VAR=VAR1-VAR4;
%LET INDEP=T1-T4;
%LET ID=ID;
%LET POSTFIX=3_333;
%LET N_GRP=3;
%TRAJ_M(DATA=&DATA.,ID=&ID.,AVEPP=&PREFIX.AVEPP_&POSTFIX.,EST=&prefix.est_&postfix.,
plot=&prefix.plot_&postfix.,stat=&prefix.stat_&postfix.,var=&var.,indep=&indep.,ngroups=&n_GRP.,
order=3 3 3,title="&postfix.");

 

and  I also want to assess the model fit write the flollowing code:

%TRAJ_ASSESS(AVEPP=&PREFIX.AVEPP_&POSTFIX.,STAT=&PREFIX.STAT_POSTFIX.,EST=&PREFIX.EST_&POSTFIX.,
BASE=M_SELECT,LABEL="&POSTFIX.");

but when i run it in the system report like that:

ay05_1-1695694139833.png

                                             fig3

and then I further write the folloing code to revise my figure;

%TRAJ_PLOT(DATA=&DATA.,ID=&ID.,AVEPP=&PREFIX.AVEPP_&POSTFIX.,EST=&prefix.est_&postfix. PLOT=&PREFIX.PLOT_&POSTFIX.,STAT=&PREFIX.STAT_POSTFIX.,GROUP=3,TRAJ1=A,TRAJ2=B,TRAJ3=C);

 

but the system reported as the same problem like fig 3. i don't know how to solve this problem.

 

 

 

 

 

 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 0 replies
  • 751 views
  • 0 likes
  • 1 in conversation