f



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

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;
>
0
msz03 (747)
2/2/2010 11:36:02 PM
comp.soft-sys.sas 142827 articles. 3 followers. Post Follow

0 Replies
552 Views

Similar Articles

[PageSpeed] 20

Reply: