DATA Step, Macro, Functions and more

Creating XLS file with no SAS variable name in Row 1

Accepted Solution Solved
Reply
Trusted Advisor
Posts: 1,604
Accepted Solution

Creating XLS file with no SAS variable name in Row 1

I want to take a SAS data set and create an XLS or XLSX file where the first row is not the SAS variable names. In other words, I want row 1 in Excel to be the first row of data in the SAS data set.

I do not want an XML file.

How can I do this?


Accepted Solutions
Solution
‎12-18-2014 03:00 PM
PROC Star
Posts: 7,356

Re: Creating XLS file with no SAS variable name in Row 1


All Replies
Solution
‎12-18-2014 03:00 PM
PROC Star
Posts: 7,356

Re: Creating XLS file with no SAS variable name in Row 1

Trusted Advisor
Posts: 1,604

Re: Creating XLS file with no SAS variable name in Row 1

Well that was way too easy! Thanks!

PROC Star
Posts: 7,356

Re: Creating XLS file with no SAS variable name in Row 1

I'll be sure to make it more difficult next time!

SAS Super FREQ
Posts: 8,739

Re: Creating XLS file with no SAS variable name in Row 1

Proc Report needs a boost. Here's the PROC REPORT/NOHEADER method.

Cynthia

ods csv file='c:\temp\noheader.csv';

proc report data=sashelp.class nowd noheader;

run;

ods csv close;

Super User
Posts: 9,662

Re: Creating XLS file with no SAS variable name in Row 1

proc export data=sashelp.class outfile='c:\temp\class.xls' dbms=xls replace;

putnames=no;

run;

Trusted Advisor
Posts: 1,604

Re: Creating XLS file with no SAS variable name in Row 1

Okay , that's a great answer.

When I tried this before posting the original question, I used dbms=excel, and I got an error. Obviously, dbms=xls works.

Can anyone explain the difference?

PROC Star
Posts: 7,356

Re: Creating XLS file with no SAS variable name in Row 1

Super User
Posts: 9,662

Re: Creating XLS file with no SAS variable name in Row 1

Yes. They are different engine. Excel engine can handle both ascii( english character) - single byte  stored and DBMS - double byte  stored ( like Chinese Korea Japanese) . but XLS only can handle  single byte  stored character( english ) . since you are from U.S , that doesn't matter if using excel or xls . But for me from China , only can use Excel engine.

Xia Keshan

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 277 views
  • 3 likes
  • 4 in conversation