BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nasser_DRMCP
Lapis Lazuli | Level 10

 

hello,

my objectif is to print the creation tables scripts of these 3 tables but only the script and prevent the print of any others kind of information in the log file. by launching this macro I get the script but the information below as well.

thanks a lot in adavnce.


proc printto log="/home/ldap/mellouna/log_macro_scrip_tables.txt" new;  run;

%macro mc_library_table_list2(p_lib_name) ;

proc sql;
   create table t_tables_list as
   select memname from dictionary.tables
   where libname="&p_lib_name" and memtype="DATA" and memname like 'CL%';
quit;

data _null_;
if 0 then set work.t_tables_list nobs=n;
call symput('mv_numobs',n);
stop;
run;

%do i=1 %to &mv_numobs;
    Data _null_;
    Set t_tables_list(firstobs=&i obs=&i);
    Call symputx('mv_table_name',memname);
    run;
options nostimer nonotes nosource;
proc sql nofeedback ;
  describe table &p_lib_name..&mv_table_name. ;
quit;

%end;

%mend ;

%mc_library_table_list2(p_lib_name=SASHELP) ;

 

 

MPRINT(MC_LIBRARY_TABLE_LIST2):   quit;
MPRINT(MC_LIBRARY_TABLE_LIST2):   Data _null_;
MPRINT(MC_LIBRARY_TABLE_LIST2):   Set t_tables_list(firstobs=2 obs=2);
MPRINT(MC_LIBRARY_TABLE_LIST2):   Call symputx('mv_table_name',memname);
MPRINT(MC_LIBRARY_TABLE_LIST2):   run;
===========> CLASSFIT options nostimer nonotes nosource
MPRINT(MC_LIBRARY_TABLE_LIST2):   proc sql nofeedback ;
MPRINT(MC_LIBRARY_TABLE_LIST2):   describe table SASHELP.CLASSFIT ;

1 ACCEPTED SOLUTION
2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

If you want the text output of the describe statements, then direct that output to a seperate file, you will always get information about the run to log, you can minimise it, but there will always be feedback.  Its really hard to follow your post but simply:

data _null_;
  set sashelp.vtable (where=(libname="&p_lib_name." and substr(memname,1,2)="CL")) end=last;
  if _n_=1 then call execute('proc printto listing="c:/code.txt";run;proc sql;');
  call execute(cats('describe table &p_lib_name..',memname,';'));
  if last then call execute('quit;proc printto listing=listing;run;');
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 545 views
  • 2 likes
  • 3 in conversation