Date: Tue, 2 Feb 2010 18:36:02 -0500
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: Exporting a SAS data set to Text file on SAS unix
Content-Type: text/plain;charset=iso-8859-1
hi ... you can try this (I changed your data set a bit) ...
* 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';
* write the variable names;
put "&vars";
file 'z:\class.txt' dsd dlm='09'x ;
* write the variable values;
do until (done);
set sashelp.class end=done;
put (_all_) (:);
end;
stop;
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
> 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;
>