I have the following section of a proc sql. The bold section below i am having trouble making it work. I created a variable cmryear that contains a 4 digit year. Depending on the date of the observation i may want to subtract one from the year for my cmrperiod variable. Does anyone have a suggestion as to how i can do this. I have tried put and input and just seem get errors when i do. I basicly want to subtract 1 from &cmryear variable for observations falling into the date range. The problem is that It doesnt like the &cmr year because it is a character value so it has to be converted.. Thank you all for your time. %let cmr_period = "CN/KTZ 2016 CMR" %let cmryear= %sysfunc(compress(&cmr_period ,"/",A)); %put output of cmryear from log is 2016 proc sql, ---other stuff Case when "&date_range_min"d <= datepart(transaction_date) <= "&date_range_max"d then catx(" ",mat.customer, "&cmryear", "CMR") when intnx("year","&date_range_min"d,-1,"sameday") <= datepart(transaction_date) < "&date_range_Min"d then catx(" ", &cmryear-1, "CMR") end as CMRPeriod, ---other stuff quit; log error - ERROR: Expression using subtraction :smileyminus: requires numeric types.
... View more