BookmarkSubscribeRSS Feed
KafeelBasha
Quartz | Level 8

Hello

 

%let r=2;

data sphere;
do u=0 to 2*constant("pi") by 0.02;
x=&r*cos(u);
y=&r*sin(u);
z=&r;
output;
end;
run;


title "Sphere";
proc g3d data=sphere;
plot y*x=z;
run;

 

When I run the above code I am getting plan,unable to see 3D plot. Please help.

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Works fine for me.  In Base SAS, run the program, then look at the Results tab, lower left, and there should be G3d: Sphere output.  Or do you mean the graph is not showing any points, well thats probably twofold.  Firstly you have no z axis data other than one variable, hence it will be flat at 2.  secondly you would need to use the proc g3grid first on the data.  Try this program.  I randomly create z (height) to show an output:

data sphere;
  call streaminit(123);
  do u=0 to 2*constant("pi") by 0.02;
    x=2*cos(u);
    y=2*sin(u);
    z=rand("Uniform");;
    output;
  end;
run;

proc g3grid data=sphere out=sphere2;
   grid y*x=z / spline;
run;

title "Sphere";
proc g3d data=sphere2;
  plot y*x=z;
run;

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