Help using Base SAS procedures

Creating Macro variables based on min max of id field

Accepted Solution Solved
Reply
Super Contributor
Posts: 400
Accepted Solution

Creating Macro variables based on min max of id field

I have a table that has a column called keyid.  I need to get the min and max of this field into macro variables so I can use them in a where clause against different tables that also have this field.

I'm currently doing it like this

proc sql noprint ;

select min(keyid) into :min_keyid

from tblRaw

;

select max(keyid) into :max_keyid

from tblRaw;

quit ;

is there a better way to do this?  I can't seem to get both variables assigned with just 1 proc sql.

Any help would be greatly appreciated.

Jerry


Accepted Solutions
Solution
‎08-04-2011 10:40 AM
PROC Star
Posts: 7,467

Creating Macro variables based on min max of id field

Posted in reply to jerry898969

Jerry,

I think you are looking for:

proc sql noprint ;

select min(keyid),max(keyid) into :min_keyid,:max_keyid

from tblRaw

;

quit ;

View solution in original post


All Replies
Solution
‎08-04-2011 10:40 AM
PROC Star
Posts: 7,467

Creating Macro variables based on min max of id field

Posted in reply to jerry898969

Jerry,

I think you are looking for:

proc sql noprint ;

select min(keyid),max(keyid) into :min_keyid,:max_keyid

from tblRaw

;

quit ;

Super Contributor
Posts: 400

Creating Macro variables based on min max of id field

Posted in reply to jerry898969

art,

Thank you that was it.

Jerry

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 168 views
  • 0 likes
  • 2 in conversation