BookmarkSubscribeRSS Feed
Gregory
Calcite | Level 5

I am trying to replicate the following code from https://onlinecourses.science.psu.edu/stat505/node/118 but it gives me the message "ERROR: Procedure GPLOT not found." I know that I need to use sgplot in some way since I use the SAS OnDemand but I am not sure what exactly I need to change in the code to make it work. If somebody could help me resolve this problem, I would appreciate it.

 

 

options ls=78;
title "Profile Plot - Spouse Data";
%let p=4;
data spouse;
infile "/folders/myfolders/STAT407/nutrient.txt";
input h1 h2 h3 h4 w1 w2 w3 w4;
variable=1; diff=h1-w1; output;
variable=2; diff=h2-w2; output;
variable=3; diff=h3-w3; output;
variable=4; diff=h4-w4; output;
drop h1 h2 h3 h4 w1 w2 w3 w4;
run;
proc sort;
by variable;
run;
proc means;
by variable;
var diff;
output out=a n=n mean=xbar var=s2;
run;
data b;
set a;
f=finv(0.95,&p,n-&p);
diff=xbar; output;
diff=xbar-sqrt(&p*(n-1)*f*s2/(n-&p)/n); output;
diff=xbar+sqrt(&p*(n-1)*f*s2/(n-&p)/n); output;
run;
proc gplot;
axis1 length=4 in;
axis2 length=6 in;
plot diff*variable / vaxis=axis1 haxis=axis2 vref=0 lvref=21;
symbol v=none i=hilot color=black;
run;

2 REPLIES 2
Reeza
Super User
SGPLOT and GPLOT are not interchangeable. You need to find the appropriate syntax. I believe PROC SGPLOT with the SCATTER along with HREF/VREF is what you're looking for, to start with .
Jay54
Meteorite | Level 14

For starters, you can use:

 

procs sgplot;
  scatter y=diff x=variable;;
  refline 0;
run;

 

If you want a HighLow plot, use HIGHLOW instead of SCATTER.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1725 views
  • 0 likes
  • 3 in conversation