The SAS Output Delivery System and reporting techniques

Case statement

Reply
Contributor
Posts: 58

Case statement

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.
SAS Super FREQ
Posts: 8,742

Re: Case statement

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
Contributor
Posts: 66

Re: Case statement

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,
Ask a Question
Discussion stats
  • 2 replies
  • 112 views
  • 0 likes
  • 3 in conversation