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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

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