Is there any way to export a datasets properties to excel? What I mean by this is that in EG if you right click on a data set, select properties and then the columns tab, SAS displays the Name, Type, Length, Format, etc for that table. I'm looking for a way to export this exact same data into excel in order to create a type of quick reference/data dictionary. Is anyone aware if this is possible?
Thank you
For adhoc applications, you can simply copy/paste the attributes from the Data summary into Excel.
For a programming approach, you can output the details in PROC DATASETS and export to Excel using either PROC EXPORT or ODS EXCEL:
proc datasets lib=sashelp nolist ;
contents data=class out=work.classattr;
quit;
/* requires SAS/ACCESS to PC Files */
proc export data=classattr
file="c:\temp\attr.xlsx"
dbms=xlsx replace;
run;
/* Base SAS in 9.4m2 or later */
ods excel file="c:\temp\attr_ods.xlsx" ;
proc print data=classattr; run;
ods excel close;
Chris
There's a couple of different ways - one is to write a proc contents and export those results to excel.
proc contents data=have;run;
For adhoc applications, you can simply copy/paste the attributes from the Data summary into Excel.
For a programming approach, you can output the details in PROC DATASETS and export to Excel using either PROC EXPORT or ODS EXCEL:
proc datasets lib=sashelp nolist ;
contents data=class out=work.classattr;
quit;
/* requires SAS/ACCESS to PC Files */
proc export data=classattr
file="c:\temp\attr.xlsx"
dbms=xlsx replace;
run;
/* Base SAS in 9.4m2 or later */
ods excel file="c:\temp\attr_ods.xlsx" ;
proc print data=classattr; run;
ods excel close;
Chris
Also, you can get this information from SASHELP.Vxxxx views, which holds inforamtion for all datasets/views available to the SAS session. VSTABLE and VCOLUMN if remember correctly could be of interest.
Thanks all for the information
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.