Help using Base SAS procedures

Export dataset to excel

Reply
Occasional Contributor Bo7
Occasional Contributor
Posts: 13

Export dataset to excel

Hello,

I have some problems with exporting my dataset to excel.

I used this code:

proc export

data=myfolder.ssbf03

DBMS=excel

outfile="users/Username/Desktop/thesis.xslx

Run

After running this code I've got following errors:

ERROR 22-322: Syntax error, expecting one of the following: ;, DATA, DBLABEL, DBMS, DEBUG, FILE, LABEL, OUTFILE, OUTTABLE, REPLACE,

  TABLE, _DEBUG_. 

ERROR 202-322: The option or parameter is not recognized and will be ignored.

Is there please someone who can help me to export this dataset. I'm not really familiar with programming so I have no idea what the problem is.

Thanks a lot!

Super User
Super User
Posts: 7,981

Re: Export dataset to excel

Couple of things wrong with the code - missing double quotes after filename, and semi-colons missing at end points, dbms=excel but extension given as XLSX.  Update to:

proc export data=myfolder.ssbf03 DBMS=excel outfile="users/Username/Desktop/thesis.xls";

run;

Note that you need to ensure the path user/username/desktop exists and you have write access to it.

Occasional Contributor Bo7
Occasional Contributor
Posts: 13

Re: Export dataset to excel

Thanks for your help, but I still cannot get it to work.

Could you maybe elaborate on what I have to do, and why exactly I have to do that?

Is it possible that the dataset is too big to export it to an excel file? I also tried to export it into a stata (dta) file, because that is the program I would like to use for my thesis research.

When I tried to run your code, I got following error message:

Schermafbeelding 2015-03-24 om 13.00.42.png

and since I am no programming expert, I have no idea what all these error messages mean.

I tried to export to a stata file, thinking the dataset was too large for an excel file and then I got this error message:

Schermafbeelding 2015-03-24 om 13.07.23.png

Can you see what the problem is based on these error messages?

Thank you so much for your help !

Super User
Super User
Posts: 7,981

Re: Export dataset to excel

Is this the University Edition of SAS?  If so then your best off posting your question in there.

I don't use UE so don't know what mappings/modules etc. you have.  The first error to me would indicate that you don't have SAS/Access licensed.  The second one indicates that the path you have given either doesn't exit, SAS can't see it, or you don't have permission to write to the area.  Have a look through the UE version forum however as there is introductory examples and others will have the same issues.

Super User
Posts: 10,044

Re: Export dataset to excel

DBMS=XLSX

Super User
Super User
Posts: 7,074

Re: Export dataset to excel

If you code DBMS=EXCEL then SAS will expect to able to communicate with a running copy of EXCEL.

Use DBMS=XLSX and SAS will generate the xlsx file itself without the need for EXCEL.

Occasional Contributor Bo7
Occasional Contributor
Posts: 13

Re: Export dataset to excel

I use the SAS University Edition.

When I try this code:

proc export data=myfolder.ssbf03 DBMS=xlsx outfile="users/boclaes/Desktop/thesis.xlsx";

run;

I got a lot of error messages as you can see on the screenshot below.

Can anyone help me with that, I really don't how to advance.

Schermafbeelding 2015-03-24 om 14.41.01.png

Super User
Posts: 10,044

Re: Export dataset to excel

Your path is wrong. If you have already set the shared fold as Doc said, you should use .

outfile="/myfolders/thesis.xlsx";

Occasional Contributor Bo7
Occasional Contributor
Posts: 13

Re: Export dataset to excel

I still get the same error message, but maybe it has something to do with the fact that it is called myfolder on my computer instead of myfolders, so without the "s". Because when I tried to make the folder I got an error message that there were too many characters as you can see here:

Schermafbeelding 2015-03-23 om 22.20.16.png

In the SAS information center, I get this message :

Schermafbeelding 2015-03-24 om 15.11.08.png

Could any of this have anything to do with the problem?

Thanks in advance!

Super User
Posts: 10,044

Re: Export dataset to excel

Check SAS University Edition 's Documentation to setup the share fold .

Occasional Contributor Bo7
Occasional Contributor
Posts: 13

Re: Export dataset to excel

I checked the documentation and corrected the name of my sharefolder into 'myfolders'.

But the problem now is that my dataset is in the 'MyFolders' map as you can see in the lefthand panel.

When I want to specify where my dataset is I used:

data=myfolders.ssbf03

But I got the error message that the libref 'MYFOLDERS' exceeds 8 characters.

Super User
Super User
Posts: 7,074

Re: Export dataset to excel

The LIBREF that you use when defining a libname is limited to 8 characters.  But since its purpose is to serve as a place holder to point to the folder it does not have to match the name of the folder.

libname mystuff '/folders/myfolders';

proc export data=mystuff.ssbf03 ....

Occasional Contributor Bo7
Occasional Contributor
Posts: 13

Re: Export dataset to excel

Thanks a lot for your help, I think I found the right code.

But now I've got the error message that my dataset contains more than 256 columns.

Is there a way to avoid this problem?

Occasional Contributor Bo7
Occasional Contributor
Posts: 13

Re: Export dataset to excel

I've finally have the dataset which i need for my master thesis.

Thank you all so much for  your help, I really appreciate all your comments!

Ask a Question
Discussion stats
  • 13 replies
  • 1329 views
  • 0 likes
  • 4 in conversation