BookmarkSubscribeRSS Feed
Fluorite | Level 6



I have spent my last week trying to find the problem. It turns out the change of streaminit(1234) doesn't help.


I tried to find the common problem when the loop breaks. The error occurs when the iSample = 24001, 45501, 72001,124001,194001... I have thought that it should be the problem of the data, but if I started another run from 24001 etc it can still run and break at another point. 


And I have also found another interesting point that at each error the program outputs a gibbsout file with exactly 13962 rows of data. So I am wondering could it be some running limit of RAND function (each time the log points to the problem of rand) or something?


I pasted here the code of the main loop to make you see the picture.


	This proc loops over all samples, calling the estimation routines.
options nonotes;
proc iml;
	start main;
	call streaminit(1234);  
	reset storage=this.imlstor;	*	This contains the subroutines built in;

	reset printadv=1 log;
	use temp.pys;
	read all var {permno year kSample} where(nTradeDays>=60) into sample [colname=colSample];  *my correction;
	nSamples = nrow(sample);
	print 'nSamples=' nSamples;
	permno = sample[,1];
	year = sample[,2];
	kSample = sample[,3];
	outSet = j(1,7,.);
	varnames ={'permno','year','kSample','c','beta','varu','sdu'};
	create this.gibbsOut from outSet [colname=varnames];
	do iSample=166001 to nSamples;
		thisPermno = permno[iSample];
		thisYear = year[iSample];
		thisKSample = kSample[iSample];
		if mod(iSample,500)=1 then do;
			t = time();
			ctime = putn(t,'time.');
			print ctime iSample '/' nSamples ': ' thisPermno thisYear thisKSample;
		if thisPermno>=&startPermno & thisYear>=1990 then do;
			use temp.dsf where (permno=thisPermno & year=thisYear & kSample=thisKSample);
			read all var {p pm q} into x [colname=colx];
			nSweeps = 1000;
			regDraw = 1;
			varuDraw = 1;
			qDraw = 1;
			nDrop = 200;
			call RollGibbsBeta(parmOut, x[,1],x[,2],x[,3], nSweeps, regDraw, varuDraw, qDraw, 0,0,0,0);
			p2 = parmOut[(nDrop+1):nSweeps,];
			p2 = p2 || sqrt(p2[,3]);
			pm = p2[+,]/(nSweeps-nDrop);
			outset = thisPermno || thisYear || thisKSample || pm;
			*print outset;
			setout this.gibbsOut;
			append from outSet;
	finish main;

Thanks again for your help.






>  It turns out the change of streaminit(1234) doesn't help.

What does this mean? You changed that line to be STREAMINIT(4321) and what happened? Did the problem occur during the same iteration, and the gibbsout data set is exactly the same?


Since the problem did not occur on the simulated data that I created, I suspect we will not be able to diagnose this problem without knowing more about the data you are using. You should contact SAS Technical Support and work with them to provide the data. Alternatively, find data for which the problem occurs and that you can share with the Community.


Calcite | Level 5

Hi Tammy, 


Have you solved the problem? I was recently using Hasbrouk's two packages to calculate equity liquidity, as you previously did. However, I met the same problem as you - "ERROR: (execution) Module not loaded, operation not available." and the loop stopped.


Could you please tell if how you fix the problem?





Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 17 replies
  • 6 in conversation