- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am looking for a way to export only the header of a dataset to Excel. No matter whether I tried, from starting with an empty dataset to using a filter right before the export, SAS doesn't export the tab that contains a header only.
Any suggestions would be highly appreciated.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Now the actual issue: I am looking for a way to export only the header of a dataset to Excel. No matter whether I tried, from starting with an empty dataset to using a filter right before the export, SAS doesn't export the tab that contains a header only.
Any suggestions would be highly appreciated.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do you have to use ODS? This works:
libname out xlsx 'myfile.xlsx';
data out.class;
set sashelp.class (obs=0);
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sounds like you tried to read the XLSX file before SAS had finished creating it. If you open the XLSX with a libname statement you need to clear the libref before it closes the file and saves it.
libname out xlsx 'myfile.xlsx';
data out.class ;
set sashelp.class ;
where age=0;
run;
data out.cars;
set sashelp.cars (obs=5);
run;
libname out clear ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I still get a $$1 file. I even erased everything in the destination folder, closed Excel, and changed the server from which I run the code. Same exact result. Using a WHERE statement vs. an OBS statement made no difference either.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Click on the vertical dot-dot-dot next the message to see the edit message menu item.