hello,
I need to print the table description (here "cars" ) into a log file. my problem is that log file holds more than the script like this"
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds"
"
But what I would like to obtain in the log file is :
create table SASHELP.CARS( label='2004 Car Data' bufsize=16384 )
(
Make char(13),
Model char(40),
Type char(8),
Origin char(6),
DriveTrain char(5),
MSRP num format=DOLLAR8.,
Invoice num format=DOLLAR8.,
EngineSize num label='Engine Size (L)',
Cylinders num,
Horsepower num,
MPG_City num label='MPG (City)',
MPG_Highway num label='MPG (Highway)',
Weight num label='Weight (LBS)',
Wheelbase num label='Wheelbase (IN)',
Length num label='Length (IN)'
);
proc printto log="/home/ldap/mellouna/log_macro_scrip_tables.txt" new; run;
proc sql;
describe table sashelp.cars ;
quit;
proc printto log="/home/ldap/mellouna/log_macro_scrip_tables.txt" new; run;
options nostimer;
proc sql nofeedback;
describe table sashelp.cars ;
quit;
Try this
Hello @Nasser_DRMCP,
Start your program with:
options nonotes nosource;
to suppress the unwanted text in the log file.
proc printto log="/home/ldap/mellouna/log_macro_scrip_tables.txt" new; run;
options nostimer;
proc sql nofeedback;
describe table sashelp.cars ;
quit;
Try this
hello r_behata,
thanks for the solution you suggested. I have a subsidiary question.
I would like to print only creation tables scripts for many tables so I have developed a loop in a maco.
but, in the log, there is still information regarding the execution that I woul like to prevent the print.
like this
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 ;
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;
%put ===========> &mv_table_name
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) ;
Use
options nomprint;
thanks a lot PaigeMIler ! perfectly my need !
hi PaigeMiller
sorry, but I still need some help.
by specifying "options nomprint", the result is muchbetter but there is still "The SAS System" printed.
thanks a lot in advance
Try this. It print as html. You can export it also.
ods html file="test.html";
proc document name=temp(write);
import textfile="path\import.sas" to ^;
replay;
run;
ods html close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.