BookmarkSubscribeRSS Feed
telescopic
Calcite | Level 5

1) I am typing some iml inside SAS base; I wonder why there is the need for the module IMl/studio?

2) From below, when I use iml to compute values,eg. n_by_na and n_by_nb, then continue with some SAS procedure. After that, I want to use iml again, the previous variables(eg. n_by_na and n_by_nb)are lost from memory.

What is the standard way to do this?

Thank you

IML Newbie

------------------------------------------

/*determine the n_a and n_b*/
proc iml;
reset log print;
N=938;
N_a=731;
N_b=207;
Ssqu_a=0.00009162;
Ssqu_b=0.08779198;
e=0.009;
z=1.75;

/*tempo1=N_a*Ssqu_a+N_b*Ssqu_b;
tempo2=(N_a*Ssqu_a);
tempo3=(N_a*Ssqu_b);*/

n_by_na= ( N_a* sqrt(Ssqu_a) +N_b*sqrt(Ssqu_b) )/( N_a*sqrt(Ssqu_a) );
n_by_nb= (N_a*sqrt(Ssqu_a)+N_b*sqrt(Ssqu_b))/(N_b*sqrt(Ssqu_b));
nsample=(z##2)/(e##2)*(  n_by_na*(N_a/N)##2*Ssqu_a + n_by_nb*(N_b/N)##2*Ssqu_b  );

nsample_a= ( N_a*sqrt(Ssqu_a) ) /( N_a* sqrt(Ssqu_a) +N_b*sqrt(Ssqu_b) )*nsample;
nsample_b= ( N_b*sqrt(Ssqu_b) ) /( N_a* sqrt(Ssqu_a) +N_b*sqrt(Ssqu_b) )*nsample;
/*end:determine the n_a and n_b*/

DATA SAMPLE_SET_A;
SET imput_out_MCMC;
WHERE(RISKGRP_logit='a');
RUN;
DATA SAMPLE_SET_B;
SET imput_out_MCMC;
WHERE(RISKGRP_logit='b');
RUN;

proc iml;

reset log print;

y_bar=(N_a/N) *0.0013578 + (N_b/N) *0.3169460;         /*After that, I want to use iml again*/
var_y_bar=(1-nsample_a/N_a)*(N_a/N)##2*(Ssqu_a)/nsample_a+ (1-nsample_b/N_b)*(N_b/N)##2*(Ssqu_b)/nsample_b;

1 REPLY 1
Rick_SAS
SAS Super FREQ

If you have SAS/IML 9.22 software or later (after Nov, 2010), you can use the SUBMIT/ENDSUBMIT statements to call SAS procedures and DATA steps from PROC IML without losing the state of your IML session:

submit;
DATA SAMPLE_SET_A;
   ...
DATA SAMPLE_SET_B;
   ...
RUN;
endsubmit;

See http://support.sas.com/documentation/cdl/en/imlug/63541/HTML/default/viewer.htm#procs_toc.htm

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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