Name the data set Subscriptions and keep it in the Work library of SAS studio.
• Subscriptions contains exactly one observation for each unique billing account (Bill_Account) that appears in Active_Jun.
• Subscriptions contains only these variables:
o Customer identity (Customer_ID)
o Billing account (Bill_Account)
o The number of subscribed services (numeric type, one service identity = one service) as on 30 June 2011
o The number of services terminated (numeric type) between the period 1 July 2011 and 31 December 2011. A missing value of the termination date indicates the respective service identity was still active on 31 December 2011.
o A billing account’s maximum tenure days (numeric type) till 31 December 2011. It is defined as the inclusive number of days between the earliest activation date of all service identities and the latest termination date of all service identities of a billing account. If the latest termination date of a service identity was beyond 31 December 2011, it is treated as 31 December 2011. For example, if a billing account has two service identities, one activated on 1 June 2011 and terminated on '.' (i.e., still active on 31 December 2011) and the other activated on 1 April 2011 and terminated on 31 July 2011. Then this account’s maximum number of tenure days is the difference
My code like this:
data Subscriptions;
set Active_Jun;
if '1JUL2011'd<=termination_date<='31DEC2011'd then no_of_service+1;
else if termination_date='' then no_of_service=0;
output;
How should I write the code for number of subscribed services and max account tenure days?
Thank You🙏