(IN= )Data Set Option

Reply
Frequent Contributor
Posts: 75

(IN= )Data Set Option

DATA died1 (RENAME = (disdate=dthdate)) ;

MERGE ex.admissions (IN=dth KEEP = pt_id disdate hosp dest

WHERE = (dest=9))

ex.patients (IN=pts KEEP = id birthdate RENAME = (id=pt_id));

BY pt_id ;

IF dth AND pts ;

agedth = FLOOR((disdate-birthdate)/365.25) ;

DROP dest birthdate ;

RUN;

I read this code in a paper.

I don't understand this line:" IF dth AND pts ;"

Is it the same as IF dth=1 AND pts=1?

Thanks

Respected Advisor
Posts: 3,799

Re: (IN= )Data Set Option

yes

Super Contributor
Posts: 644

Re: (IN= )Data Set Option

This is an example of a SAS "Subsetting IF".  It is shorthand for

     If <expression is true> ; * continue ;

          Else delete ;

An expression is true if it evaluates to any positive or negative number, excluding zero.

If the expression evaluates to zero or a missing value then it is false.

So the expression

     If year ;

would include rows for all years except 0, and rows where year was null in the data.

Richard now back in NZ

Occasional Contributor
Posts: 9

Re: (IN= )Data Set Option


This is the equivalent of INNER JOIN in a [PROC] SQL statement. The key values of both input tables must match in order for the two records be merged into the output table.

Ask a Question
Discussion stats
  • 3 replies
  • 263 views
  • 0 likes
  • 4 in conversation