BookmarkSubscribeRSS Feed
deleted_user
Not applicable
This is Microsoft SQL Server Query, can SAS SQL can do something like this?
USE AdventureWorks;
GO
SELECT ProductNumber, Name, 'Price Range' =
CASE
WHEN ListPrice = 0 THEN 'Mfg item - not for resale'
WHEN ListPrice < 50 THEN 'Under $50'
WHEN ListPrice >= 50 and ListPrice < 250 THEN 'Under $250'
WHEN ListPrice >= 250 and ListPrice < 1000 THEN 'Under $1000'
ELSE 'Over $1000'
END
FROM Production.Product
ORDER BY ProductNumber ;
GO
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
I believe the CASE clause is ANSI standard SQL. PROC SQL (the SAS implementation of SQL) does support use of the CASE clause. For more help on SAS and PROC SQL and the CASE clause, you might look in the PROC SQL documentation or consult with Tech Support for more help.

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 1 reply
  • 1012 views
  • 0 likes
  • 2 in conversation