BookmarkSubscribeRSS Feed
Wes
Calcite | Level 5 Wes
Calcite | Level 5
i have dataset as following

now i have a question about usin IML in proc sql as the code below

in the code, RollGibbs is the code using IML dsIn is the data read

i can not understand why do this procedure?

please help me~plz



data zachary;
input id x;
cards;
1 4
1 2
1 3
2 3
2 4
2 5
2 4
3 5
3 8
;

%macro zachary(n);
%do i=1 %to &n;
proc sql noprint;
create table set&i as
select id,%RollGibbs(dsIn); as mean_x
from zachary
where id=&i
group by id;
quit;
%end;
%mend;
%zachary(3);
1 REPLY 1
Rick_SAS
SAS Super FREQ
I don't understand what the SQL code is trying to do. Is this some kind of resampling? Please describe in words what you are trying to accomplish, or provide the macro function that you are calling so that we can run it ourselves.

If this is a resampling problem, I would do it all in SAS/IML without bothering with SQL. For example, I'd read in the ID variable, use the UNIQUE function to get the numbers {1,2,3}, and then use RANDGEN to generate random numbers in the range 1:3. I can't tell yet how you are using the X variable.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 1454 views
  • 0 likes
  • 2 in conversation