BookmarkSubscribeRSS Feed
x_yang
Fluorite | Level 6

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;
72
73 proc iml;
NOTE: IML Ready
74 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.
81
82 symbol1 v=circle i=sm5; title1 ’Power Curve for Z-test’;
82 symbol1 v=circle i=sm5; title1 ’Power Curve for Z-test’;
_______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
83 axis1 label=(’prob’);
83 axis1 label=(’prob’);
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
84 axis2 label=(’delta’);
84 axis2 label=(’delta’);
_____
180
ERROR 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 seconds
cpu time 0.00 seconds
85 proc gplot data = q5_data;
ERROR: Procedure GPLOT not found.
86 plot y*delta / haxis=axis2
87 vaxis=axis1
88 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 seconds
cpu time 0.01 seconds
90
91
92 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
104
Any help would be appreciated!
1 REPLY 1
Cynthia_sas
SAS Super FREQ

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:

 curly_quotes_not_good.png

 

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:

code_runs_good_quotes.png

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 674 views
  • 0 likes
  • 2 in conversation