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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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