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
Diamond | Level 26
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,
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1162 views
  • 0 likes
  • 3 in conversation