f



Re: Exporting a SAS data set to Text file on SAS unix #3

hi ... actually, what I posted earlier was too much code  (sorry)
this is enough (a bit more succinct)


* variable names into a macro variable (tab separated);
proc sql noprint;
select name into :vars separated by '09'x
from dictionary.columns
where libname eq 'SASHELP' and  memname eq 'CLASS'
order varnum;
quit;

data _null_;
file 'z:\class.txt' dsd dlm='09'x ;
if _n_ eq 1 then put "&vars";
set sashelp.class;
put (_all_) (:);
run;

--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475

> You could try PROC EXPORT instead of the datastep... it should work to
> export a comma-delimited file.  But Mike's suggestion will work well, and
> might be more flexible for you - and is not dissimilar to what PROC EXPORT
> actually physically does, I suspect.
>
> -Joe
>
> On Tue, Feb 2, 2010 at 3:48 PM, Ranjhana <ranjhanas@gmail.com> wrote:
>
>> Hi All,
>>
>> I used the following code to export a SAS dataset to text file, but i
>> am unable to get the header. Can anybody tell me how to get the header
>> (Variable names) to the text file ?
>>
>> Filename out "/home/z19/test_export.txt";
>> data _null_;
>> set ranj.layout_archive_prodcar;
>> file out;
>> put (_all_) ('09'x);
>> run;
>>
>
0
msz03 (747)
2/3/2010 12:44:28 AM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
821 Views

Similar Articles

[PageSpeed] 46

Reply: