Hello,
I am trying to get p value and t values for given data. Every time I try to run my data, keeps giving me ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, ;, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL,
NOTIN, OR, ^=, |, ||, ~=.
My SAS code is below. Any help would be appreciated.
data A1;
n = 12;
mu0 = 241;
xbar = 235;
sd = 12.5;
se = sd/sqrt(n);
df = n-1
tval = (xbar-mu0)/se;
pval = (1-cdf('T',abs(tval),df))*2;
run;
proc print data=A1;
run;
Hi @Joliek44
it seems that you have a missing semi-colon at the end of the following statement:
df = n-1;
Best,
Hello,
Oh my gosh. Yes! That was it. Thank you. I can't believe i overlooked that.
And why we indicate that with error messages you should post the LOG of the whole proc or data step that included the error:
462 data A1; 463 n = 12; 464 mu0 = 241; 465 xbar = 235; 466 sd = 12.5; 467 se = sd/sqrt(n); 468 df = n-1 469 tval = (xbar-mu0)/se; ---- 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, ;, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=. 470 pval = (1-cdf('T',abs(tval),df))*2; 471 run;
The underscores appearing under the first element of the line means indicates that the previous line is expected to be continued and what you have doesn't fit in the possible syntax. So look to the previous line.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.