03-01-2017 09:49 PM
I am trying to export all the variable name, their trype(char, num, data), along with their dataset name to a Excel sheet.
Tried the following code(thanks to SASKIWI) , but got only the list of variables name and respective dataset thary belong, i need the variable type as well.
/* Note that value of libname is UPPERCASE */
create table columns as
select name as variable
,memname as table_name
where libname = 'WORK'
/* SAS 9.4 or later */
ods excel file="C:\e_Contents.xlsx" style=minimal;
proc print data=columns;
ods excel close;
/* earlier versions, using SAS/ACCESS to PC Files */
PROC EXPORT data = columns
OUTFILE = 'e_Contents.xls'
DBMS = EXCEL REPLACE;
03-02-2017 11:25 AM
If you use this code you can find out how to request other items from dictionary.columns
proc sql; describe table dictionary.columns; run;
which would lead to
proc sql; create table columns as select name as variable ,memname as table_name,type from dictionary.columns where libname = 'WORK' ; quit;