☑ This topic is solved.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 12-06-2024 08:36 AM
(599 views)
Hi all,
I have a list of values as below and want to assign macro variables (num_val&i.) like num_val1 for 0.5, num_val2 for 0.9, ... num_val5 for 2. Can anyone help me out? Thank you!
data have;
infile datalines truncover dsd;
input num_val;
datalines;
0.5
0.9
1.1
1.5
2
;
run;
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try this
proc sql noprint;
select num_val into :num_val1 -
from have
;
quit;
%put &=num_val1.;
%put &=num_val2.;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try this
proc sql noprint;
select num_val into :num_val1 -
from have
;
quit;
%put &=num_val1.;
%put &=num_val2.;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In general, I am skeptical that this is a good approach. Can you please share with us what you will do with these macro variables once they are created, that cannot be done using data set HAVE?
Anyway, here is the code you want.
data _null_;
set have;
call symputx(cats('num_val',_n_),num_val);
run;
--
Paige Miller
Paige Miller