BookmarkSubscribeRSS Feed
YoloY
Calcite | Level 5

I ran the SAStraj program, and the result is shown in figure, but cannot be exported to a PDF file.I would appreciate it if someone could help me solve this problem.

ods pdf file="E:\traj.pdf";
%macro traj(data, out, op, os ,oe, nn,order,tilte,subtitle);
PROC TRAJ DATA=&data OUT=&out OUTPLOT=&OP OUTSTAT=&OS OUTEST=&OE; 
id pe_id;
VAR ecrf_06 ecrf_08 ecrf_10 ecrf_12; 
INDEP T1-T4; 
MODEL CNORM;
MIN 0; 
MAX 100; 
NGROUPS &nn;
ORDER ℴ 
RUN;
%mend traj;
%traj(men, out, op, os ,oe,3, 4 4 4,Men,Group3);
ods pdf close;

1.png

3 REPLIES 3
MayurJadhav
Quartz | Level 8

Not sure why it is not working neither I've used proc traj procedure before but it looks like if you put ods statement inside the sas macro might work.

Also, it is worth checking destination path is accessible. @YoloY 

 

Like this:

%macro traj(data, out, op, os ,oe, nn,order,tilte,subtitle);
ods pdf file="E:\traj.pdf";
PROC TRAJ DATA=&data OUT=&out OUTPLOT=&OP OUTSTAT=&OS OUTEST=&OE; 
id pe_id;
VAR ecrf_06 ecrf_08 ecrf_10 ecrf_12; 
INDEP T1-T4; 
MODEL CNORM;
MIN 0; 
MAX 100; 
NGROUPS &nn;
ORDER ℴ 
RUN;
ods pdf close;
%mend traj;
%traj(men, out, op, os ,oe,3, 4 4 4,Men,Group3);
Mayur Jadhav
BI Developer. Writer. Creative Educator.

SAS Blog → https://learnsascode.com
YouTube Channel: → https://www.youtube.com/@imayurj
YoloY
Calcite | Level 5

Thank you. I tried the program you recommended, but the SAS log shows that ODSPDF printing did not produce output.

SASKiwi
PROC Star

Are there any ODS-related errors or notes in your SAS log? Try using TRAJ outside of a macro to exclude that as a possible cause.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1008 views
  • 0 likes
  • 3 in conversation