Prev: if last statement with missing
Next: HASH Help Needed
From: Jay on 20 Apr 2010 13:07 Hi guys, I'm a SAS noob and need your help I want to take all the SAS data set files in a directory and convert them to csv files I want to use %ds2csv (data=myfolder."&char", runmode=b, csvfile="&char".csv); where myfolder is a LIBNAME and char is the filename in an array of filenames I created in a previous step, how would I get this to work many thanks
From: data _null_; on 20 Apr 2010 15:43 On Apr 20, 12:07 pm, Jay <jingsi....(a)gmail.com> wrote: > Hi guys, I'm a SAS noob and need your help > > I want to take all the SAS data set files in a directory and convert > them to csv files > I want to use > > %ds2csv (data=myfolder."&char", runmode=b, csvfile="&char".csv); > > where myfolder is a LIBNAME and char is the filename in an array of > filenames I created in a previous step, how would I get this to work > > many thanks Consider this technique which produces the same result. %let library=work; data _null_; length ddname $8 filevar $256; _n_ = filename(ddname,,'TEMP'); filevar = pathname(ddname); file dummy filevar=filevar; do until(eof); set sashelp.vmember(keep=libname memname memtype) end=eof; where libname eq "%upcase(&library)" and memtype eq 'DATA'; csvfile = catx('.',memname,'CSV'); data = catx('.',libname,memname); put '%ds2csv(' data= ', runmode=b, ' csvfile=:$quote100. +(-1) ');'; end; call execute(catx(' ','%inc',ddname,'/ source2;')); stop; run;
From: data _null_; on 20 Apr 2010 16:32 On Apr 20, 12:07 pm, Jay <jingsi....(a)gmail.com> wrote: > Hi guys, I'm a SAS noob and need your help > > I want to take all the SAS data set files in a directory and convert > them to csv files > I want to use > > %ds2csv (data=myfolder."&char", runmode=b, csvfile="&char".csv); > > where myfolder is a LIBNAME and char is the filename in an array of > filenames I created in a previous step, how would I get this to work > > many thanks %let library=work; data _null_; length ddname $8 filevar $256; _n_ = filename(ddname,,'TEMP'); filevar = pathname(ddname); file dummy filevar=filevar; do until(eof); set sashelp.vmember(keep=libname memname memtype) end=eof; where libname eq "%upcase(&library)" and memtype eq 'DATA'; csvfile = catx('.',memname,'CSV'); data = catx('.',libname,memname); put '%ds2csv(' data= ', runmode=b, ' csvfile=:$quote100. +(-1) ');'; end; call execute(catx(' ','%inc',ddname,'/ source2;')); stop; run;
|
Pages: 1 Prev: if last statement with missing Next: HASH Help Needed |