Hi All,
I am having following dataset with stock values.daily the values will change , i need to find dynamically , values less than .5 and create a macro variable.
data have;
input name stockrate;
datalines;
xyz 0.015
abc 0.9
fxy .86
tdf .02
boa .76
wfd .005
;
run;
in the above case there are 3 companies less than .5(xyz,tdf,wfd). latest data may change to other companies. right no i am enter manually like checking stockrate and enter the company names.
like %let stat=xyz tdf wfd
i am looking for dynamic approach to check the values , and pick the company names and fill the %let stat = (what ever the companies <.5)
Any insight on this
Thanks
sam
proc sql;
select name
into :Stat separated by ' '
from have
where stockrate < .5;
quit;
proc sql;
select name
into :Stat separated by ' '
from have
where stockrate < .5;
quit;
Thank you DBailey,
This is what i am looking for
Thank you once again
Sam
Hi ,
We can also do the same through the sasdataset .
%macro low ;
data low_&sysdate ;
set have ;
where stockrate < 0.5 ;
run;
%mend ;
%low ;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.