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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.