BookmarkSubscribeRSS Feed
SamT
Calcite | Level 5
Hey,

Quick question. I need to export my data sets without variable names, can you use something like firstobs = 2 like on Proc Import? Or is there a global option for it?

Thanks

Sam
4 REPLIES 4
Ksharp
Super User
In the first Page of support.sas.com ,You can find answer.


http://support.sas.com/kb/41/735.html


If your export file is xls .use

[pre]
proc export data=sashelp.class
outfile='c:\temp\classnoheaders.xls'
dbms=xls replace;
putnames=no;
run;
[/pre]


Ksharp
SamT
Calcite | Level 5
Is there any reasons 'putnames' wouldn't work?

proc export data = rwork.Vehicle_Opt
outfile = '\\int\folder\name.csv'
dbms = csv REPLACE;
putnames=no;
run;

I've tried that previously but i keep getting the ever so familiar 'Statement is not valid or out of order.'
Peter_C
Rhodochrosite | Level 12
> Is there any reasons 'putnames' wouldn't work?
> proc export data = rwork.Vehicle_Opt
> outfile = '\\int\folder\name.csv'
> dbms = csv REPLACE;
> putnames=no;
> run;
>
> I've tried that previously but i keep getting the ever so familiar 'Statement is not valid or out of order.'

on the link provided by "Ksharp" it says the feature works in SAS version 9.2
"Beginning in SAS 9.2, you can use the the PUTNAMES= "
As your version doesn't support it, what version of SAS are you running?
If you need data without headers and you cannot install the latest release, here is an alternative : the 5 lines of code
data _null_ ;
set rwork.Vehicle_Opt ;
file '\\int\folder\name.csv' dsd lrecl= 10000 ;
put (_all_)(:) ;
run;
That put statement directs SAS to put all columns in ":" formatting (remove leading and trailing blanks from columns when placed in the output), the "DSD" option directs that the columns should be separated by commas (with quoting of any data values containing commas), and that LRECL= provides more than the default 256 width for the output lines

That should work in any release since SAS8.
It is the ultimate CSV delivery process. imho
peterC
SamT
Calcite | Level 5
Thanks mate works a treat.

I'm running 9.1 ... Thought I was on .2 but I guess not haha.

Thanks again Peter.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 2769 views
  • 1 like
  • 3 in conversation