BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
CerditoSalvaje
Obsidian | Level 7

Hello everybody, I have a silly question, but I've been working on it since 3 days. 

In the sashelp.lake database we have the same X repeated the length of Y times. And I have to do something like that to represent a function with proc g3d (in order to have z = y*x). 

 

If you could please tell me how sashelp.lake is created is gonna be very helpful.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

No idea how LAKE dataset was generated but perhaps something like:

 

data test1;
  do width=0 to 10 by 0.5 ;
    do length=0 to 7 by 0.5 ;
      z= width*length ;
      output;
    end;
  end;
run;

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

No idea how LAKE dataset was generated but perhaps something like:

 

data test1;
  do width=0 to 10 by 0.5 ;
    do length=0 to 7 by 0.5 ;
      z= width*length ;
      output;
    end;
  end;
run;
CerditoSalvaje
Obsidian | Level 7

my problem is that I want to display a funcion in SAS with proc G3D and I need the data in the same order than lake. But, I have to take X and Y from an uniform law. I'm able to generate Y with IML but not X. 

proc iml;
xmax=2;
xmin=-2;
range=xmax-xmin;
Y=j(range,1,0);
X=j(range,1,0);
X1=j(range*range,1,0);
do i=1 to range;
	call randgen(u,'uniform');
	Y[i,1]=xmin+u*range;
end;

do i=1 to range/2;
	y=y//y;
end;

do i=1 to range;
	call randgen(u1,'uniform');
	X[i,1]=xmin+u1*range;
end;

do i=1 to range;
	do n=1 to range*range;
		X1[n,1]=X[i,1];
	end;
end;
print X1;
run;
quit;

 The idea is to have the axis X1 (which represents the variable x of the function) like the X from sashelp.lake : with a repeated value for each repetition. 

ballardw
Super User

Since the SASHELP.Lake has exactly 3 variables, Width, Length and Depth I am not sure at all what you mean by " X repeated the length of Y times".

 

If you want to make graph using Proc G3D the data available should work. The X and Y variables could be either of Width and Length and the Z variable would be Depth.

 

Proc g3d data=sashelp.lake;
   plot width*length=depth;
run;
quit; 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 317 views
  • 2 likes
  • 3 in conversation