I created a couple of data sets in sas that export to excel. I need to create a description tab that describe my data sets. I was tying to find out a code sample for SAS, where I could put some text in that code and it would create a tab in XL file with that text in it.
Thank you!
Pipe the results from SASHELP.VTABLE or VCOLUMNS to an excel file within and ODS EXCEL?
ods excel file = "/folders/myfolders/demo.xlsx" style=meadow;
proc print data=sashelp.vcolumn;
where libname = 'SASHELP' and memname = 'CLASS';
var libname memname name type length format;
run;
ods excel options(sheet_interval="NOW");
proc print data=sashelp.class;
run;
ods excel close;
Conceptually, I think you're looking for something like that. You can also use PROC ODSTEXT to pipe text directly to the report.
@JaneS wrote:
I created a couple of data sets in sas that export to excel. I need to create a description tab that describe my data sets. I was tying to find out a code sample for SAS, where I could put some text in that code and it would create a tab in XL file with that text in it.
Thank you!
Possibly just Proc Contents for the data sets of interest?
Thank you so much for everyone's reply! I am a little confused about this code, as where would I paste text. Just as an example, if I have this text:
Assuming your datasets have labels, you could do something like this using sashelp.vtable (which is a table that exists behind-the-scenes, storing summary info about the datasets):
proc sql noprint;
create table summary as
select unique memname, memlabel
from sashelp.vtable
where libname='MAPSGFK'
and memname in ('FRANCE' 'GERMANY' 'EGYPT');
quit; run;
title "Datasets in this spreadsheet";
proc print data=summary label noobs;
run;
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.