BookmarkSubscribeRSS Feed
Dhrijan
Calcite | Level 5

Hi All

I have created a selection in SAS Campaign Studio with alot of nodes. The selection was to select people who:

  • Has not purchased certain products, BUT has purchased more than 3 or more of these certain products in the last 12 months

I know there is CASE statement which can be used, but not sure how to apply in SAS

Can anyone help?

Thanks in advance

3 REPLIES 3
Dhrijan
Calcite | Level 5

I should have mentioned what I am after is the CASE statement for this so people dont need to have knowledge of SAS Campaign Studio

Dhrijan
Calcite | Level 5

Please see example below of the CASE statements:

sum(case when <<root.product>> in ('VD', 'VN', 'DM','PD','4PR','UN','ID','LT','N','IN') then 1 else 0 end)

What is the difference between having the 'sum' at the front or not having it at the front?

Thanks

Tom
Super User Tom
Super User

The SUM function will aggregate over the observations for given set of values of the grouping variables.  Normally you would want that OUTSIDE the case statement.  In this example the case statement will assign a number to each of the observations and then the SUM function will add them up.

There might be situations where you would put the sum function inside the case statement, but this example does not look like one.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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