I am using sas 9.4
I have a dataset 10000x7 looks like this
survtime cont Trial SurvI Treat PatID Sim
1 2.271536 2.6398586 1 1 0 1 1
2 2.920410 -0.1787789 1 1 0 2 1
3 1.328392 -2.1513527 1 1 0 3 1
4 11.433881 2.2132001 1 1 0 4 1
5 20.264126 0.9029487 1 0 1 5 1
6 19.827590 0.3236216 1 0 1 6 1
last column is 'Sim' take values 1 to 10 and changes every 1000 times, like 1 to 1000 sim=1 1001 to 2000 sim=2 . . 9001 to 10000 sim=10
and then I have a macro
%NORMSURV(data=prostate,true=survtime,trueind=survind,surrog=psa,treat=treat,center=trial,patientid=patid,copula=houggard,adjustment=weighted,imagefmt=eps);
I want to run this macro for each sim value and get two values TAU and R2
I like to clear a point let's say there is no 'sim', only 1000x6 I can get those values
proc print data=sur_measure_clay ;
VAR TAU R2;
run;
with running that code.
now I have 10 of them, I can do by hand but I will have 100 of them to draw a histogram I want to run keep those 2 values to get a histogram plot. 'data=sur_measure_clay' is a default name comes from macro. Thank you
In my opinion, the proper way to do this task will be to modify your macro to do histograms through your whole dataset. Assuming macro %NORMSURV works as described by you, it can be done as below:
/* there is no need to use proc sql
if you know how much of iteration do you have */
proc sql noprint;
select distinct max(sim)
into : max_iter
from prostate;
quit;
%put Maximum value of Sim Variable : &max_iter;
Then you can put your macro inside another loop
%macro sim_iterate;
%do iter = 1 %to &max_iter;
data tmp;
set prostate;
where sim = &max_iter;
run;
/* Run your instructions */
%end;
%mend;
%sim_iterate;