Help using Base SAS procedures

function like don't work in data step, if clause

Reply
N/A
Posts: 0

function like don't work in data step, if clause

Hello,

I need to swap "sql like" function for a similar one on the "data step if clause".

Ex.:
proc sql;
select
case
when descr_job like '%DOC%' then 'Doctor'
else ''
end as group
from employees

Ex.:
data new_employees;
set employees;

if descr_job like '%DOC%' then group = 'Doctor';
else group = '';
run;

Obs.: This data step don't work in SAS 8.2.

What fuction can i use in this case?
Super Contributor
Super Contributor
Posts: 3,174

Re: function like don't work in data step, if clause

Do you not have access to SAS Documentation? Consider the INDEX function.

Scott Barry
SBBWorks, Inc.

SAS v8 DOC (not a very clean interface)
http://v8doc.sas.com/sashtml/


SAS 9 DOC
http://support.sas.com/onlinedoc/913/docMainpage.jsp?


Current SAS DOC starter page:
http://support.sas.com/documentation/onlinedoc/base/index.html
PROC Star
Posts: 1,561

Re: function like don't work in data step, if clause

As Scott said.

Also, like is for where clauses only.
N/A
Posts: 0

Re: function like don't work in data step, if clause

I used the index function and this work

tks
Ask a Question
Discussion stats
  • 3 replies
  • 77 views
  • 0 likes
  • 3 in conversation