BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sam369
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
DBailey
Lapis Lazuli | Level 10

proc sql;

select name

into :Stat separated by ' '

from have

where stockrate < .5;

quit;

View solution in original post

3 REPLIES 3
DBailey
Lapis Lazuli | Level 10

proc sql;

select name

into :Stat separated by ' '

from have

where stockrate < .5;

quit;

sam369
Obsidian | Level 7

Thank you DBailey,

This is what i am looking for

Thank you once again

Sam

naveen20jan
Obsidian | Level 7

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 963 views
  • 0 likes
  • 3 in conversation