<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to print the output after using submit and endsubmit in Proc IML? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-print-the-output-after-using-submit-and-endsubmit-in-Proc/m-p/669976#M5209</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using (proc lifereg) in my SAS IML, So I used&amp;nbsp;submit and endsubmit&amp;nbsp; to get out of IML and then I used (Use-Read-Close) to save my results from the previous step and save them on a vector for later use.&lt;/P&gt;
&lt;P&gt;The problem is that I can't print my final answer.&amp;nbsp; I am not sure what else do I need to do.&amp;nbsp; Any help is highly highly appreciated. Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
	k=10;
	seed=0;
	scheme=1;
	n=30;
	m=20;
	r=J(m, 1, 0);
	r[m]=10;
	sigma1=1;
	sigma2=1;
	pi=22/7;
	ru=0.2;
	* this is the correlation;
	mu1=0;
	mu2=0;
	B0=1;
	B1=0.2;
	lambda=.5;
	Y=J(m, 1, 0);
	XX=J(m, 1, 0);
	** Simulation of progressive censoring ****;
	Ww=J(m, 1, 0);
	X=J(m, 1, 0);
	UU1=J(m, 1, 0);
	U2=J(m, 1, 0);
	T1=J(n, 1, 0);
	V=J(n, 1, 0);
	Y1=J(m, 1, 0);
	Z1=J(n, 1, 0);
	Z2=J(n, 1, 0);
	Ee=J(m, 1, 0);
	Vv=J(m, 1, 0);
	ll=J(m, 1, 0);
	EST1=J(n, 1, 0);
	EST3=J(n, 1, 0);

	Do N1=1 to K;
		** Creation of the progressive data from Uniform;
		************************************************;

		do i=1 to m;
			Ww[i]=Uniform(seed);
			ll[i]=i;
			sum=0;

			do j=m-i+1 to m;
				sum=(R[j]+sum);
			end;
			Ee[i]=1/(i+sum);
			Vv[i]=Ww[i]**Ee[i];
		end;

		do i=1 to m;
			prod=1;
			endloop=m-i+1;

			do k1=m to endloop by -1;
				prod=Vv[k1]*prod;
			end;
			UU1[i]=1-(prod);
			** the U's are the required progressively type II
right censored sample from U(0,1);
		end;
		U_obs=UU1||J(m, 1, 1);
		** progressive censored data of size m from U(0,1) with idex=1 to indicate the event occurs;
		** I need the data to have a size n, so I need to generate more data from Uniform(0,1) with size of n-m;
		UU0=J(n-m, 1, 0);

		do j=1 to n-m;
			UU0[j]=Uniform(seed);
		end;
		U_Cen=UU0||J(n-m, 1, 0);
		* These are the censored data with idex 0;
		U=J(n, 2, 0);
		U=U_obs//U_cen;
		U_1=U[, 1];
		* This is the first column of the matrix U which represents the data from Uniform both(observed + censored);
		U_2=U[, 2];
		* This is the index (1:failure OR 0:Censored);
		Z1=quantile('Normal', U_1);
		* this is how we generate the covariate vector which is associated with Beta1;

		/*do j=1 to n;
		
		V[j]=Uniform(seed);
		
		end;
		
		 *Z2=quantile('Normal',V);
		
		y1=(ru#Z1+sqrt(1-ru**2)#Z2)#sigma2+mu2; **/
		C=B0+B1#Z1;
		T1=exp(C)#(-log(U_1))##lambda;

		/*Weibull**;*/
		/* (1) To use the values of my r.v. in proc lifereg, we need to write them to a SAS data set using CREATE and APPEND
		statements. These statements create data set AFT;*/
		create AFT var {"U_obs", "U_Cen", "U" , "U_1" , "U_2", "T1", "Z1"};
		append;
		close AFT;
		* (2) Next, the lifereg procedure is called from within IML by using SUBMIT and ENDSUBMIT statements. ;
		submit;

	proc lifereg data=AFT outest=AFT_out covout;
		model T1*U_2(0)=Z1 / dist=WEIBULL;
	run;

	data new_AFT;
		set AFT_out;
		keep Z1;
	run;

	proc transpose data=new_AFT out=idnumber name=Test prefix=sn;
	run;

	endsubmit;
	* (3) To read the results back to SAS/IML we write "use", "read", and "close";
	Use idnumber;
	read all var {Sn1 Sn2 Sn3 Sn4};
	Close idnumber;
	Est1[N1]=Sn1;
	end;
	*end of simulation loop (NN);
	Est1_Hat=Est1[:];
	print Est1_Hat;
	Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jul 2020 20:32:31 GMT</pubDate>
    <dc:creator>Salah</dc:creator>
    <dc:date>2020-07-16T20:32:31Z</dc:date>
    <item>
      <title>How to print the output after using submit and endsubmit in Proc IML?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-print-the-output-after-using-submit-and-endsubmit-in-Proc/m-p/669976#M5209</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using (proc lifereg) in my SAS IML, So I used&amp;nbsp;submit and endsubmit&amp;nbsp; to get out of IML and then I used (Use-Read-Close) to save my results from the previous step and save them on a vector for later use.&lt;/P&gt;
&lt;P&gt;The problem is that I can't print my final answer.&amp;nbsp; I am not sure what else do I need to do.&amp;nbsp; Any help is highly highly appreciated. Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
	k=10;
	seed=0;
	scheme=1;
	n=30;
	m=20;
	r=J(m, 1, 0);
	r[m]=10;
	sigma1=1;
	sigma2=1;
	pi=22/7;
	ru=0.2;
	* this is the correlation;
	mu1=0;
	mu2=0;
	B0=1;
	B1=0.2;
	lambda=.5;
	Y=J(m, 1, 0);
	XX=J(m, 1, 0);
	** Simulation of progressive censoring ****;
	Ww=J(m, 1, 0);
	X=J(m, 1, 0);
	UU1=J(m, 1, 0);
	U2=J(m, 1, 0);
	T1=J(n, 1, 0);
	V=J(n, 1, 0);
	Y1=J(m, 1, 0);
	Z1=J(n, 1, 0);
	Z2=J(n, 1, 0);
	Ee=J(m, 1, 0);
	Vv=J(m, 1, 0);
	ll=J(m, 1, 0);
	EST1=J(n, 1, 0);
	EST3=J(n, 1, 0);

	Do N1=1 to K;
		** Creation of the progressive data from Uniform;
		************************************************;

		do i=1 to m;
			Ww[i]=Uniform(seed);
			ll[i]=i;
			sum=0;

			do j=m-i+1 to m;
				sum=(R[j]+sum);
			end;
			Ee[i]=1/(i+sum);
			Vv[i]=Ww[i]**Ee[i];
		end;

		do i=1 to m;
			prod=1;
			endloop=m-i+1;

			do k1=m to endloop by -1;
				prod=Vv[k1]*prod;
			end;
			UU1[i]=1-(prod);
			** the U's are the required progressively type II
right censored sample from U(0,1);
		end;
		U_obs=UU1||J(m, 1, 1);
		** progressive censored data of size m from U(0,1) with idex=1 to indicate the event occurs;
		** I need the data to have a size n, so I need to generate more data from Uniform(0,1) with size of n-m;
		UU0=J(n-m, 1, 0);

		do j=1 to n-m;
			UU0[j]=Uniform(seed);
		end;
		U_Cen=UU0||J(n-m, 1, 0);
		* These are the censored data with idex 0;
		U=J(n, 2, 0);
		U=U_obs//U_cen;
		U_1=U[, 1];
		* This is the first column of the matrix U which represents the data from Uniform both(observed + censored);
		U_2=U[, 2];
		* This is the index (1:failure OR 0:Censored);
		Z1=quantile('Normal', U_1);
		* this is how we generate the covariate vector which is associated with Beta1;

		/*do j=1 to n;
		
		V[j]=Uniform(seed);
		
		end;
		
		 *Z2=quantile('Normal',V);
		
		y1=(ru#Z1+sqrt(1-ru**2)#Z2)#sigma2+mu2; **/
		C=B0+B1#Z1;
		T1=exp(C)#(-log(U_1))##lambda;

		/*Weibull**;*/
		/* (1) To use the values of my r.v. in proc lifereg, we need to write them to a SAS data set using CREATE and APPEND
		statements. These statements create data set AFT;*/
		create AFT var {"U_obs", "U_Cen", "U" , "U_1" , "U_2", "T1", "Z1"};
		append;
		close AFT;
		* (2) Next, the lifereg procedure is called from within IML by using SUBMIT and ENDSUBMIT statements. ;
		submit;

	proc lifereg data=AFT outest=AFT_out covout;
		model T1*U_2(0)=Z1 / dist=WEIBULL;
	run;

	data new_AFT;
		set AFT_out;
		keep Z1;
	run;

	proc transpose data=new_AFT out=idnumber name=Test prefix=sn;
	run;

	endsubmit;
	* (3) To read the results back to SAS/IML we write "use", "read", and "close";
	Use idnumber;
	read all var {Sn1 Sn2 Sn3 Sn4};
	Close idnumber;
	Est1[N1]=Sn1;
	end;
	*end of simulation loop (NN);
	Est1_Hat=Est1[:];
	print Est1_Hat;
	Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 20:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-print-the-output-after-using-submit-and-endsubmit-in-Proc/m-p/669976#M5209</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2020-07-16T20:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to print the output after using submit and endsubmit in Proc IML?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-print-the-output-after-using-submit-and-endsubmit-in-Proc/m-p/669987#M5210</link>
      <description>&lt;P&gt;When I run your code,&amp;nbsp;it prints the&amp;nbsp;Est1_Hat value. I suspect at some point you were experimenting with ODS SELECT or ODS EXCLUDE or even ODS close;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try submitting&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ODS SELECT ALL;&lt;/P&gt;
&lt;P&gt;and rerunning the program. If there is still no output, make sure a destination is open, such as&lt;/P&gt;
&lt;P&gt;ODS HTML;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are still having problems, save the program and restart SAS. Unless there are statements that you did not post, the program should print the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 20:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-print-the-output-after-using-submit-and-endsubmit-in-Proc/m-p/669987#M5210</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-07-16T20:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to print the output after using submit and endsubmit in Proc IML?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-print-the-output-after-using-submit-and-endsubmit-in-Proc/m-p/669989#M5211</link>
      <description>&lt;P&gt;Thank you Rick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works thank you so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Salah&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 20:57:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-print-the-output-after-using-submit-and-endsubmit-in-Proc/m-p/669989#M5211</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2020-07-16T20:57:05Z</dc:date>
    </item>
  </channel>
</rss>

