|
Steven,
You can create code from the second file to execute in PROC DATASETS a
number of ways - write it to a temp file, use CALL EXECUTE, etc.
For example (not tested):
filename a temp;
data _null_;
set labelfile;
file a;
string=catx(' ','label',varname,'=',label,';');
put string;
run;
proc datasets lib=work;
modify datasettomodify;
%include a;
quit;
or
data _null_;
set labelfile end=eof;
string=catx(' ','label',varname,'=',label,';');
if _n_ = 1 then do;
call execute("proc datasets lib=work; modify datasettomodify;");
end;
call execute(string);
if eof then do;
call execute("quit;");
end;
run;
Possible proc datasets syntax errors aside, that should accomplish what
you're trying to accomplish.
-Joe
On Mon, Dec 6, 2010 at 1:45 PM, Steven Chang <zzhang@hsph.harvard.edu>wrote:
> Hi all,
> I have one data set with many variables without labels.
> I have another data set which has two variables: variable_name and label.
>
> How can I add the labels in the second file to my first data sets?
>
> Thanks,
> Steven
>
|