Date: Mon, 16 Feb 2009 08:14:43 -0600
Reply-To: "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: CSV file with PROC SQL
In-Reply-To: <200902161356.n1GBlL16001358@malibu.cc.uga.edu>
Content-Type: text/plain; charset=GB2312
With just a little more code you can have it all.
options missing=' ';
%let pathl=.;
data _null_;
file "&pathl\datafilename.csv" dsd lrecl= 10000 ;
*file log dsd;
if _n_ eq 1 then link names;
set sashelp.class;
put (_all_)(:) ;
return;
names:
put (_all_)(=) @1 @;
_file_ = compress(tranwrd(_file_,'=',','),' ');
_file_ = substr(_file_,1,length(_file_)-1);
put;
return;
run;
On 2/16/09, Peter Crawford <peter.crawford@blueyonder.co.uk> wrote:
> On Mon, 16 Feb 2009 05:46:49 -0800, frederick.raymond@GMAIL.COM wrote:
>
> >On 16 fúI 10:59, nil...@GMX.NET (Nili Nili) wrote:
> >> Hello,
> >>
> >> My dataset it huge (300000 observations) and I would like to save it as
> CSV file, so that I could work with it in EXCEL later on. I separated it
> in 5 different datasets (largest = 115532 obs and smallest=21564 obs) If I
> start to use ODS CSV, my application crashed. Is there any possibility to
> create a CSV file with PROC SQL and not with ODS?
> >> I use SAS 8.2 .
> >>
> >> Thanks you in advance for your ideas.
> >> Regards,
> >> Nili
> >>
> >> --
> >> Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL
> >> f? 17,95 Euro/mtl.!*http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
> >
> >hi Nili,
> >
> >I would give a try with this:
> >
> >proc contents data=yourdataset out=listvar noprint;
> >run;
> >
> >data listvar;
> > set listvar end = last;
> > call symput('item'||trim(left(_N_)),variablename);
> > call symput('items'||trim(left(_N_)),secondvariablename);
> > if last then call symput('numvar',trim(left(_N_)));
> >run;
> >
> >data _null_;
> > set yourdataset;
> > file "&pathl\datafilename.csv" encoding="utf-8" lrecl=10000;
> > %do i = 1 %to &numvar;
> > put &&item&i;
> > put ',';
> > put &&items&i;
> > %end;
> >run;
>
> could be simpler :
>
> data _null_ ;
> file "&pathl\datafilename.csv" dsd lrecl= 10000 ;
> set your_data_set ;
> put (_all)(:) ;
> run;
>
> Of course that comes in column (varnum) order and without heading line.
> Is that a problem?
>
> PeterC
>
|