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

Hi Everyone,

 

I'm working on a SAS EG querybuilder, and i'm trying to make a new computed column. This one needs to find certain letters in an existing column. Accordingly, in the new column, it's supposed to show certain words, based on which letter was found. In the original column (let's call it Column A) there is a string of one letter, followed by a bunch of numbers. For example: C.0974893938. There can be four different letters at the beginning of this code. L & S mean it's a project, C is for capacity and P is for pricing. Right now, this is my code: 

 

case when find(t1.'Column A'n, 'C') then 'Capacity' or find(t1.'Column A'n, 'P') then 'Pricing' else 'Project' end

 

I have never tried 'then' twice in one code (and it appears to not be working), but I don't really know any other way to solve this one. Can you help me? Many thanks!

 

Best,

Margot

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
Kurt_Bremser
Super User
case 
  when find(t1.'Column A'n, 'C') then 'Capacity' 
  when find(t1.'Column A'n, 'P') then 'Pricing'
  else 'Project'
end

each THEN needs a WHEN.

Margot89
Calcite | Level 5

Thank you, this worked wonderfully!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 557 views
  • 0 likes
  • 2 in conversation