Reputation: 719
I'd like to use the date as a variable name. I understand I'll need to append a character to the front and also that it's not a good way to store data (it's purely for report aesthetics). I've tried %eval()
but can't solve it.
%let var_date = '_'||today();
data date;
%eval(&var_date) = .;
run;
I'd like the variable name to be _02JUN2011
. Thanks for any help.
Upvotes: 1
Views: 2295
Reputation: 719
This does what I'm looking for. Is this maintainable?
data date1;
date = put(today(),date9.);
text = '';
do i = 1 to 5;
output;
end;
run;
proc transpose data = date1 out = date2;
by i;
id date;
var text;
run;
Upvotes: 0
Reputation: 2460
I don't think you want to take this approach. You should use labels in PROC REPORT (or any other reporting PROC), or pivot your data dynamically instead. Perhaps if you describe the data you've got and the output you want, people here will be able to help find an appropriate solution.
For your edification though, the following code does what you're trying to do in your post:
%let var_date=_%sysfunc(today(),date9.); data test; &var_date=.; run;
Upvotes: 3