BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mczeg
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

4 REPLIES 4
Reeza
Super User

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;
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
LinusH
Tourmaline | Level 20

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.

Data never sleeps
mczeg
Calcite | Level 5

Thanks all for the information

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 7493 views
  • 0 likes
  • 4 in conversation