Help using Base SAS procedures

If then statement

Accepted Solution Solved
Reply
Contributor
Posts: 48
Accepted Solution

If then statement

Good morning,

I'd like to create a variable "usedate" where usedate will take the value of "termdate" and if "termdate" is not available it would take the value of "sentdate." While I'm familiar with how to write it in SPSS, I'm not sure how to write it in SAS.


Accepted Solutions
Solution
‎02-27-2013 08:59 AM
Super User
Super User
Posts: 7,065

Re: If then statement

If by not available you mean the value is missing then you could do:

if not missing(termdate) then usedate=termdate;

else usedate=sentdate;

or you could use the coalese function

usedate=coalese(termdate,sentdate);

View solution in original post


All Replies
Solution
‎02-27-2013 08:59 AM
Super User
Super User
Posts: 7,065

Re: If then statement

If by not available you mean the value is missing then you could do:

if not missing(termdate) then usedate=termdate;

else usedate=sentdate;

or you could use the coalese function

usedate=coalese(termdate,sentdate);

Contributor
Posts: 48

Re: If then statement

Perfect. Thank you!

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 159 views
  • 1 like
  • 2 in conversation