Hello,
I am new to sas and running the proc traj analysis. I am trying to run the analysis on a data set i created in excel just creating random numbers to see if my analysis will work. When I run the code that I have obtained from the proc traj site, I get the error that I have in the title. This is the code I use:
PROC TRAJ DATA=OPPOSITN OUTPLOT=OP OUTSTAT=OS OUT=OF OUTEST=OE ITDETAIL; ID ID; VAR O1-O7; INDEP T1-T7; MODEL CNORM; MAX 10; NGROUPS 3; ORDER 3 3 3; RUN; %TRAJPLOT(OP,OS,'Opposition vs. Scaled Age','Cnorm Model','Opposition','Scaled Age')
This is the code I copied and I switched it to this:
PROC TRAJ DATA=Sample OUTPLOT=OP OUTSTAT=OS OUT=OF OUTEST=OE ITDETAIL;
ID ID; VAR TO1-TO4; INDEP D1-D4;
MODEL CNORM; MAX 10; NGROUPS 3; ORDER 3 3 3;
RUN;
%TRAJPLOT(OP,OS,'Opposition vs. Scaled Age','Cnorm Model','Opposition','Scaled Age')
Any ideas why it is not working? Thank you!
Again..first error:
ERROR: VAR data is outside of the range of MIN=0.00 and MAX=10.00
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 10 observations read from the data set WORK.SAMPLE.
I think this is an error from PROC TRAJ so I would check their documentation regarding the restrictions on the VAR variable and see what you need to change in your data to make it fit within the procedure.
Maybe a basic question, but have to check....
Have you installed the TRAJ procedure modules? TRAJ is not included with SAS -- it was developed by 3rd party researchers/developers. Download is here:
https://www.andrew.cmu.edu/user/bjones/download.htm
You would need admin access to your SAS environment to install these.
Please post your full log
NOTE: WORK.SAMPLE data set was successfully created.
NOTE: The data set WORK.SAMPLE has 10 observations and 9 variables.
1 PROC TRAJ DATA=Sample OUTPLOT=OP OUTSTAT=OS OUT=OF OUTEST=OE ITDETAIL;
2 ID ID; VAR TO1-TO4; INDEP D1-D4;
ERROR: Variable TO1 not found.
3 MODEL CNORM; MAX 10; NGROUPS 3; ORDER 3 3 3;
4 RUN;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.OP may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: The data set WORK.OS may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: The data set WORK.OF may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: The data set WORK.OE may be incomplete. When this step was stopped there were 0
observations and 0 variables.
NOTE: PROCEDURE TRAJ used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
5 %TRAJPLOT(OP,OS,'Opposition vs. Scaled Age','Cnorm Model','Opposition','Scaled Age')
NOTE: Writing HTML Body file: sashtml.htm
NOTE: The data set WORK.CPREDTMP has 0 observations and 1 variables.
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.15 seconds
cpu time 0.07 seconds
NOTE: There were 0 observations read from the data set WORK.CPREDTMP.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: Deleting WORK.CPREDTMP (memtype=DATA).
NOTE: PROCEDURE DATASETS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: Variable pi is uninitialized.
NOTE: There were 0 observations read from the data set WORK.OS.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
WARNING: The value for the ACROSS option must be greater than 0. The specified value will be ignored.
WARNING: Variable T not found in data set WORK.OP.
WARNING: Variable AVG1 not found in data set WORK.OP.
NOTE 137-205: Line generated by the invoked macro "TRAJPLOT".
5 legend1 label=('Group Percents') value=(%unquote(&GpPcts)) across=&Cnt; proc
5 ! gplot data=&PlotFile; title1 &Title1; title2 &Title2; format t 12.2 avg1 12.2;
5 ! plot &aline &pline / overlay legend=legend1; label t=&Xlab;
-
22
ERROR 22-322: Syntax error, expecting one of the following: a name, (.
NOTE: Line generated by the invoked macro "TRAJPLOT".
5 legend1 label=('Group Percents') value=(%unquote(&GpPcts)) across=&Cnt; proc
5 ! gplot data=&PlotFile; title1 &Title1; title2 &Title2; format t 12.2 avg1 12.2;
5 ! plot &aline &pline / overlay legend=legend1; label t=&Xlab;
-
76
ERROR 76-322: Syntax error, statement will be ignored.
NOTE: The previous statement has been deleted.
WARNING: Variable T not found in data set WORK.OP.
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
NOTE: PROCEDURE GPLOT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Ok, so you fix errors in the order they appear. The first error is actually:
ERROR: Variable TO1 not found.
Can you please verify that in the data set called, SAMPLE that you have a variable called TO1?
You can do that via PROC CONTENTS. Note that I'm not sure if it's T01 (zero) vs TO1 (letter o). I suspect that's the mistake.
proc contents data=sample;run;
Hello,
I have fixed this issue. I changed the T01 to Tes01.
This is the new log:
28 PROC TRAJ DATA=Sample OUTPLOT=OP OUTSTAT=OS OUT=OF OUTEST=OE ITDETAIL;
29 ID ID; VAR Tes01-Tes04; INDEP D1-D4;
30 MODEL CNORM; MAX 10; NGROUPS 3; ORDER 3 3 3;
31 RUN;
*** SAS PROC TRAJ *** Bobby L. Jones, Version Date: Dec 8 2010
ERROR: VAR data is outside of the range of MIN=0.00 and MAX=10.00
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 10 observations read from the data set WORK.SAMPLE.
WARNING: The data set WORK.OP may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: Data set WORK.OP was not replaced because this step was stopped.
WARNING: The data set WORK.OS may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: Data set WORK.OS was not replaced because this step was stopped.
WARNING: The data set WORK.OF may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: Data set WORK.OF was not replaced because this step was stopped.
WARNING: The data set WORK.OE may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: Data set WORK.OE was not replaced because this step was stopped.
NOTE: PROCEDURE TRAJ used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
32 %TRAJPLOT(OP,OS,'Opposition vs. Scaled Age','Cnorm Model','Opposition','Scaled Age')
NOTE: The data set WORK.CPREDTMP has 0 observations and 1 variables.
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: There were 0 observations read from the data set WORK.CPREDTMP.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
NOTE: Deleting WORK.CPREDTMP (memtype=DATA).
NOTE: PROCEDURE DATASETS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: Variable pi is uninitialized.
NOTE: There were 0 observations read from the data set WORK.OS.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
WARNING: The value for the ACROSS option must be greater than 0. The specified value will be ignored.
WARNING: Variable T not found in data set WORK.OP.
WARNING: Variable AVG1 not found in data set WORK.OP.
NOTE 137-205: Line generated by the invoked macro "TRAJPLOT".
5 legend1 label=('Group Percents') value=(%unquote(&GpPcts)) across=&Cnt; proc
5 ! gplot data=&PlotFile; title1 &Title1; title2 &Title2; format t 12.2 avg1 12.2;
5 ! plot &aline &pline / overlay legend=legend1; label t=&Xlab;
-
22
ERROR 22-322: Syntax error, expecting one of the following: a name, (.
NOTE: Line generated by the invoked macro "TRAJPLOT".
5 legend1 label=('Group Percents') value=(%unquote(&GpPcts)) across=&Cnt; proc
5 ! gplot data=&PlotFile; title1 &Title1; title2 &Title2; format t 12.2 avg1 12.2;
5 ! plot &aline &pline / overlay legend=legend1; label t=&Xlab;
-
76
ERROR 76-322: Syntax error, statement will be ignored.
NOTE: The previous statement has been deleted.
WARNING: Variable T not found in data set WORK.OP.
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
NOTE: PROCEDURE GPLOT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Again..first error:
ERROR: VAR data is outside of the range of MIN=0.00 and MAX=10.00
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 10 observations read from the data set WORK.SAMPLE.
I think this is an error from PROC TRAJ so I would check their documentation regarding the restrictions on the VAR variable and see what you need to change in your data to make it fit within the procedure.
Please mark this question as solved.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.