BookmarkSubscribeRSS Feed
eslna
Obsidian | Level 7

Hello guys,

 

I have been looking around the communities and Google today trying to find a way to do this but I havent been able to. I am new-ish to SAS programming so please bear with me.

 

I would like to write a program that automatically checks which tables are loaded in LASR and do a proc contents ONLY to the tables that are currently loaded. 

 

I have looked at Proc imstat, Proc SQL, Proc LASR to see if there is a way to check Load/Unload status on a LASR table but I am coming up empty.

 

Is there a SAS Variable(either in dictionary or otherwise) that provides this information, and if so, which Proc would work best?

 

 

6 REPLIES 6
Shmuel
Garnet | Level 18

Im not familiar with SAS Analytics, but I have the feeling that you might find answer or guide in the next link:

 

http://support.sas.com/documentation/cdl/en/vaug/65747/HTML/default/viewer.htm#p1ta97n7v64u6hn1adg3s...

 

Look also to the contents on left side of the page.

 

Using SAS BASE / SQL you can get all availabale tables and columns by:

 

Proc sql;

        create table  u_name_it as select *

        from dictionary.columns;

quit;

 

I don't know how to recognize LASR tables and distinguish them from others.

If you know add a WHERE statment to the SQL, to subset them only.

      

eslna
Obsidian | Level 7

Dictionary.tables doesnt seem to have an attribute for Loaded/Unloaded status.

 

I also tried Dictionary.columns it either makes my SAS Session unresponsive, or errors out when it tries to read an unloaded table.

SASKiwi
PROC Star

A great question and one I'd like to know the answer for too. I did a bit of searching and I think the answer is here in the special memory usage tables available for SAS VA:

 

http://support.sas.com/documentation/cdl/en/inmsref/68736/HTML/default/viewer.htm#p050lknh5xepngn1s2...

 

 

mike2468
Obsidian | Level 7

I wrote a macro to do something similar. I wanted to check a table's load status and, if it is unloaded, fire a stored procedure that loads it. It's for reloading critical tables after a reboot, but you could adapt it for your needs. It uses the _T_TABLEMEMORY set in the LASR library.

 

Instead of checking a specific table you will want to filter down the loadedtables dataset and then iterate through the rows to fire your PROC CONTENTS.

 

 

data loadedtables;
set VALIBLA._T_TABLEMEMORY;
run;

%macro ifunloaded(tablename, thescript);
	proc sql noprint;
		select count(*) into :OBSCOUNT from loadedtables where tablename = upper(&tablename) and uncompressedsize > 0;
	%if &OBscount = 0 %then %do;
		%put "&tablename is unloaded, we need to reload it";
		proc stp program=&thescript; 
		run;
		put "Table &tablename was unloaded and reload was attempted.";
		
	%end;
	%else %do;
		%put "&tablename is already loaded, leave it alone";
	%end;
%mend ifunloaded

 

 

eslna
Obsidian | Level 7

Thanks for the replies, will look into each and every one today and let you know which one worked best.

eslna
Obsidian | Level 7
So you are basically checking if there are any observations first. That is very ingenious. I will keep it in mind. Will continue to research if there is an actual flag that can be surfaced via Base SAS code first though.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 2644 views
  • 0 likes
  • 4 in conversation