DATA Step, Macro, Functions and more

data _null_

Reply
N/A
Posts: 0

data _null_

Can anyone teach me how to loop the records in a dataset and
put it on a macro variable and create file?

I have attached a sample but it is not working.

data _null_;
do until(eof);
set sample end=eof;
file "d:\data\"&file".html";
end;
run;
SAS Employee
Posts: 160

Re: data _null_

do you want to write the names of the variables to a file ?

%let file = variables;
data _null_;
set sashelp.vcolumn(where=(libname='SASHELP' and memname='CLASS'));
file "d:\&file..html" dsd;
put name @;
run;
SAS Employee
Posts: 160

Re: data _null_

or do you want to create a new file name from the content of your data ?

data _null_;
set sashelp.class;
filename= cats('d:\',name,'.htm');
file dummy filevar=filename dsd;
put age;
run;
Ask a Question
Discussion stats
  • 2 replies
  • 144 views
  • 0 likes
  • 2 in conversation