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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 1549 views
  • 1 like
  • 3 in conversation