BookmarkSubscribeRSS Feed
abcd123
Fluorite | Level 6

Hello, All

I have an empty dataset:

data test;

length var1 8 var2 $ 8 var3 8;

label var1='label for variable 1'

      var2='label for variable 2'

      var3='label for variable 1'

      ;

stop;

run;

Now I want to export this empty dataset to excel, using the label as the first row in excel:

proc export data=test

                   outfile='c:\temp\test.xlsx'

                  label

                 dbms=excel replace;

run;

However I got following error message:

ERROR: Error attempting to CREATE a DBMS table. ERROR: Execute: Field 'label for variable 1'

already exists in table 'TEST'..

I actually found this post ;  but it does not seem to work for exporting an empty dataset.

Is there a way to make such export possible? Thanks.

2 REPLIES 2
ballardw
Super User

Depending on your needs, exporting as a CSV seems to work. File will need a CSV instead of XLSX extension but can still open in Excel then save as if needed.

damAK
Calcite | Level 5

Extending to the question:

I have exported the empty dataset to csv. still it is giving the error.

ERROR: Export unsuccessful.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1826 views
  • 0 likes
  • 3 in conversation