BookmarkSubscribeRSS Feed
PJorge
Calcite | Level 5

Hi,

I'm trying to export data to an excel file without labeling it since I want the first row in the excel file to be the first row with data in the EG database.

I have EG 4.3 SAS9.2

proc export

data=work.QUERY_ART

DBMS=excelcs

outfile="C:\Documents\Reports SAS\Test.xls"

Replace;

PUTNAMES=NO;

Sheet="Test";

Server="pgl0408";

Port=8629;

Run;

However it gets an "ERROR 180-322: Statement is not valid or it is used out of proper order." for the putnames statement.

Appreciate all the help.

6 REPLIES 6
stat_sas
Ammonite | Level 13

Hi,

I think PUTNAMES=NO will not work with excel file. Try to export it as csv file.

Thanks

Reeza
Super User

Why do you need no names?

When EG imports it strips the first row usually anyways.

Ksharp
Super User

Did you try ODS ?

ods tagsets.excelxp file='c:\temp\x.xls' ;
proc report data=sashelp.class noheader nowd;
run;
ods tagset.excelxp close;

Xia Keshan

PJorge
Calcite | Level 5

Hi,

I have tried with ODS as you mentioned:

ods tagsets.ExcelXP file='C:\Documents\Reports SAS\test1.XLS';

Proc Report data=work.query_art_vta_compl noheader nowd;

run;

ods tagsets.ExcelXP close;

and it turns out the following error:

ERROR: Physical file does not exist, C:\Documents\Reports SAS\test1.XLS.

And it did produces any file.

ballardw
Super User

Are running this on a server or locally. The server may not have a path available of C:\Documents\Reports SAS.

stat_sas
Ammonite | Level 13

Hi,

Use this for the desired output.

Thanks,

Naeem

proc export

data=work.QUERY_ART

DBMS=csv

outfile="C:\Documents\Reports SAS\Test.csv"

Replace;

PUTNAMES=NO;

Run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 4918 views
  • 0 likes
  • 5 in conversation