Help using Base SAS procedures

Proc Export

Reply
Occasional Contributor
Posts: 16

Proc Export

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
Super User
Posts: 9,681

Re: Proc Export

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
Occasional Contributor
Posts: 16

Re: Proc Export

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.'
Valued Guide
Posts: 2,175

Re: Proc Export

> 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_)(Smiley Happy ;
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
Occasional Contributor
Posts: 16

Re: Proc Export

Thanks mate works a treat.

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

Thanks again Peter.
Ask a Question
Discussion stats
  • 4 replies
  • 509 views
  • 1 like
  • 3 in conversation