BookmarkSubscribeRSS Feed
Md_SIhab_Sarar
Calcite | Level 5

Hi everyone,

I'm currently working on fitting 21 years of data into Group-Based Trajectory Modeling (GBTM) using PROC TRAJ in SAS. Here's the code snippet I'm using:

sas 9.4
Copy code
PROC TRAJ DATA=OPPOSITN OUTPLOT=OP OUTSTAT=OS OUT=OF OUTEST=OE ITDETAIL CI95M;
ID ID;
VAR O13-O264;
INDEP T1-T252; /* Year – 1992 - 2012 (21 Years) */
MODEL CNORM;
MAX 30;
NGROUPS 3;
ORDER 1 1 2 ;
RUN;

%TRAJPLOT(OP, OS, 'Trajectory Of Year 1991 - 2012', 'Cnorm Model', 'Temp Diff.', 'Time (Months)');

%TRAJPLOTNEW (OP,OS,'Trajectory Of Year 1991 to 2012', 'CNorm Model', 'Temp Diff.', 'Scaled Time');

 

Screenshot 2023-11-08 235315.pngScreenshot 2023-11-08 235349.png
This code generates a graph, as shown in the attached image. However, I'm facing an issue with the X-axis; it's displaying 300 units, including 48 blank points. Is there a way to modify the TRAJPLOT to plot only the required 252 units on the X-axis, corresponding to the 21-year timeline from 1992 to 2012?

I'm seeking guidance on how to adjust the X-axis in the TRAJPLOT to ensure it only displays the necessary 252 units and eliminates the extra blank points.

Thank you for your help and suggestions!

Best regards,

MD. Sihab Sarar

1 REPLY 1
sbxkoenk
SAS Super FREQ

Hello,

 

PROC TRAJ is a user-written procedure.

%TRAJPLOT and %TRAJPLOTNEW are user-written macro's.

All 3 things above are NOT SAS-supplied.

 

You can contact the author of PROC TRAJ

or you can extract the code generated by the macro (use mprint option and copy/paste from the LOG).

Then submit the proc gplot or the proc sgplot again with your own x-axis scaling.

 

Here are some examples that might inspire you:
https://support.sas.com/en/knowledge-base/graph-samples-gallery.html

PROC GPLOT : https://support.sas.com/sassamples/graphgallery/PROC_GPLOT.html

PROC SGPLOT : https://support.sas.com/sassamples/graphgallery/PROC_SGPLOT.html

 

Good luck,

Koen

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 763 views
  • 1 like
  • 2 in conversation