Hi,
So I hope to plot a curve of dots and lines connecting the dots, and below is my code. I am new to SAS and I wonder if the problem is due to the use of iml here. I also pasted the error log below.
proc iml;
delta = do(0, 16, 2);
alpha = 0.1;
z_half_alpha = quantile('NORMAL', 1-(alpha/2));
n = 10;
sigma = 8;
y = 1 - cdf('NORMAL', (z_half_alpha - delta)/sqrt(2*(sigma**2)/n)) + cdf('NORMAL', (- z_half_alpha - delta)/sqrt(2*(sigma**2)/n));
create q5_data var {delta y}; append; close q5_data;
symbol1 v=circle i=sm5; title1 ’Power Curve for Z-test’;
axis1 label=(’prob’);
axis2 label=(’delta’);
proc gplot data = q5_data;
plot y*delta / haxis=axis2
vaxis=axis1
vref=0.95;
run;And this is the log when I run this piece of code on SAS Studio:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;7273 proc iml;NOTE: IML Ready74 delta = do(0, 16, 2);75 alpha = 0.1;76 z_half_alpha = quantile('NORMAL', 1-(alpha/2));77 n = 10;78 sigma = 8;79 y = 1 - cdf('NORMAL', (z_half_alpha - delta)/sqrt(2*(sigma**2)/n)) + cdf('NORMAL', (- z_half_alpha -79 ! delta)/sqrt(2*(sigma**2)/n));80 create q5_data var {delta y};80 ! append;80 ! close q5_data;NOTE: The data set WORK.Q5_DATA has 9 observations and 2 variables.8182 symbol1 v=circle i=sm5; title1 ’Power Curve for Z-test’;82 symbol1 v=circle i=sm5; title1 ’Power Curve for Z-test’;_______180ERROR 180-322: Statement is not valid or it is used out of proper order.83 axis1 label=(’prob’);83 axis1 label=(’prob’);_____180ERROR 180-322: Statement is not valid or it is used out of proper order.84 axis2 label=(’delta’);84 axis2 label=(’delta’);_____180ERROR 180-322: Statement is not valid or it is used out of proper order.NOTE: Exiting IML.NOTE: The SAS System stopped processing this step because of errors.NOTE: PROCEDURE IML used (Total process time):real time 0.00 secondscpu time 0.00 seconds85 proc gplot data = q5_data;ERROR: Procedure GPLOT not found.86 plot y*delta / haxis=axis287 vaxis=axis188 vref=0.95;89 run;NOTE: The SAS System stopped processing this step because of errors.NOTE: PROCEDURE GPLOT used (Total process time):real time 0.00 secondscpu time 0.01 seconds909192 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;104
Hi:
I believe this previous posting sheds some light on your issue: https://communities.sas.com/t5/SAS-Programming/Smart-Quotes-Vs-Simple-Quotes/td-p/396099
I think you're having the "smart" quote vs "simple" quote issue or what I call "curly" quotes vs "straight" quotes. Here's a screen shot of your posted code. Note the difference in quotes:
You might have copied the PROC GPLOT code from Word or a PDF file that used the "smart" or "curly" quotes. In any case, I believe you need to type over the bad quotes with good quotes. When I did that, the code ran for me:
Note that to stop PROC GPLOT, you need to add a QUIT; statement after the RUN; statement. You should notice the good color coding for quoted strings in your editor when you get the quotes all changed.
Cynthia
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!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.