BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
alexdsa310
Obsidian | Level 7

i am using proc sql to join and want to use a condition something like this  which was used in datastep.

if mapsubmitted="Y" and (cats(substr(term,1,1),substr(term,length(term)))="()" or term="*") then do;
_rc=_values_.add();
end;

 

i am using the below

proc sql;
create table _values_ as
select distinct b.table,b.column,b.origin,b.originwhere,b.algorithm
from vcol a right join source_columns b
on a.origin=b.origin
where substr(b.term,length(b.term))="()";
quit;

i used where substr(b.term,length(b.term))="()";

 

In this i want to take values in term which are enclosed in "()" or which has "*".

 

values in term are below. i want to take only terms which are enclosed in () and which has *.

 

(MMSE)

(ND)

ISO 8601

 *

 

can any one help me on this.

1 ACCEPTED SOLUTION

Accepted Solutions
gamotte
Rhodochrosite | Level 12
Hello,

Why don't you use the same condition as in your datastep ? Here, you only take the last character of term instead of concatenating the first and last characters.

You can also use this condition :
WHERE b.term like "(%)" or b.term="*";

View solution in original post

1 REPLY 1
gamotte
Rhodochrosite | Level 12
Hello,

Why don't you use the same condition as in your datastep ? Here, you only take the last character of term instead of concatenating the first and last characters.

You can also use this condition :
WHERE b.term like "(%)" or b.term="*";

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 755 views
  • 0 likes
  • 2 in conversation