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;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.