BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
AnnLyn
Fluorite | Level 6

How can I easy create storage/size in memeory information of all tables in a specific cas lib.

I use this:

proc cas;
table.tabledetails /name="%" caslib="XXXX";

quit;

 

but it fails. it seems that I can not use a wildcards in that manner?

 

Do you have some code which could help me?

1 ACCEPTED SOLUTION

Accepted Solutions
Mazi
Pyrite | Level 9

cas mycas;

libname casuser cas caslib=casuser;

proc casutil;
	load data=sashelp.cars
		 outcaslib="casuser"
		 casOut="cars"
		 replace;

	load data=sashelp.class
		 outcaslib="casuser"
		 casOut="class"
		 replace;

	load data=sashelp.baseball
		 outcaslib="casuser"
		 casOut="baseball"
		 replace;
run;

proc cas;
	table.tableinfo result=rc /caslib="casuser";
	fragment=';';
	do table over rc["TableInfo"][,"Name"];
		table.tabledetails result=result/name=table caslib="casuser";
		saveresult result caslib="casuser" casout=table;
		code="data casuser.allResults"||fragment|| "set casuser."||table||";length Data varchar(100);Data='"||table||"';run;";
		datastep.runcode/code=code;
		fragment='(append=yes);';
	end;
quit;

Give this a try

View solution in original post

6 REPLIES 6
Mazi
Pyrite | Level 9
proc casutil;
	load data=sashelp.cars
		 outcaslib="casuser"
		 casOut="cars"
		 replace;

	load data=sashelp.class
		 outcaslib="casuser"
		 casOut="class"
		 replace;

	load data=sashelp.baseball
		 outcaslib="casuser"
		 casOut="baseball"
		 replace;
run;

proc cas;
	table.tableinfo result=rc /caslib="casuser";
	do table over rc["TableInfo"][,"Name"];
		table.tabledetails /name=table caslib="casuser";
	end;
quit;

Can you try this?

AnnLyn
Fluorite | Level 6

It works perfectly - thanks a lot. Is it possible to output the results in a table? thanks in advance.

Mazi
Pyrite | Level 9
Hi, Yes -

We can use the saveresult statement to do this.

Do you want them appended to one table or a different table for each?
AnnLyn
Fluorite | Level 6

I would prefer one table as it can be used for a report afterwards. Thanks in advance.

Mazi
Pyrite | Level 9

cas mycas;

libname casuser cas caslib=casuser;

proc casutil;
	load data=sashelp.cars
		 outcaslib="casuser"
		 casOut="cars"
		 replace;

	load data=sashelp.class
		 outcaslib="casuser"
		 casOut="class"
		 replace;

	load data=sashelp.baseball
		 outcaslib="casuser"
		 casOut="baseball"
		 replace;
run;

proc cas;
	table.tableinfo result=rc /caslib="casuser";
	fragment=';';
	do table over rc["TableInfo"][,"Name"];
		table.tabledetails result=result/name=table caslib="casuser";
		saveresult result caslib="casuser" casout=table;
		code="data casuser.allResults"||fragment|| "set casuser."||table||";length Data varchar(100);Data='"||table||"';run;";
		datastep.runcode/code=code;
		fragment='(append=yes);';
	end;
quit;

Give this a try

AnnLyn
Fluorite | Level 6

it works great. Thank you so much for your help. I am very happy with your solution.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 834 views
  • 1 like
  • 2 in conversation