BookmarkSubscribeRSS Feed
lloraine
Calcite | Level 5
I am trying to define a column using the following:
CASE T3."COMPONENT_PRODUCT_ID"
WHEN NULL THEN T3."ICIS_PRODUCT_ID"
ELSE T3."COMPONENT_PRODUCT_ID"
END AS PSEUDO_PRID,

SAS does not like this. Is there another way to define a column called PSEUDO_PRID
code like when the field Component_Product_Id is null then give me ICIS_Product_Id else give me Component_Product_Id.
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
This is not an ODS or Base Reporting (PROC PRINT, REPORT, TABULATE) question.

The SAS documentation for PROC SQL does have examples of using a CASE clause. Alternately, you might consider contacting Tech Support for help. To send a question to Tech Support, go to http://support.sas.com/ and in the left-hand navigation pane, click on the link entitled "Submit a Problem".

cynthia
CameronLawson
Obsidian | Level 7
Try using sas functions.

I kind of remember using something similar to the following in some code some while back...

In proc sql try the following;
case t3.component_product_id;
when Missing(t3.component_product_id) eq 1 then t3.ics_product_id etc;

In Datastep;
Select (component_product_id)
When (Missing(compoonent_product_id) eq 1) then ics_product_id eq ''; etc

hope that helps....



CASE T3."COMPONENT_PRODUCT_ID"
WHEN NULL THEN T3."ICIS_PRODUCT_ID"
ELSE T3."COMPONENT_PRODUCT_ID"
END AS PSEUDO_PRID,

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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