Need help.....!!!
I want to classified data with function substr and sql procedure...
This code can't solve my problem.....
================================================
proc sql;
create table Tas1 as
select a.*, b.CampName,b.ProdName
, case substr(a.Campaign, -5,3)
when 'JAN' then 1
when 'FEB' then 2
when 'MAR' then 3
when 'APR' then 4
when 'MAY' then 5
when 'JUN' then 6
when 'JUL' then 7
when 'AUG' then 8
when 'SEP' then 9
when 'OCT' then 10
when 'NOV' then 11
when 'DEC' then 12
else 0 end as mth
, case substr(b.MONTH, 1,3)
when 'JAN' then 1
when 'FEB' then 2
when 'MAR' then 3
when 'APR' then 4
when 'MAY' then 5
when 'JUN' then 6
when 'JUL' then 7
when 'AUG' then 8
when 'SEP' then 9
when 'OCT' then 10
when 'NOV' then 11
when 'DEC' then 12
else 0 end as mth ,&yy as year from Tas a left join ProductDef b on a.campaignid=b.CampId
where substr(b.CampName,1,1) ^="'" and ProdName ^="CANCEL";
quit;
or this....
========================================================
proc sql;
create table Tas1 as
select a.*, b.CampName,b.ProdName
, case substr(b.MONTH, -5,3) or substr(b.MONTH, 1,3)
when 'JAN' then 1
when 'FEB' then 2
when 'MAR' then 3
when 'APR' then 4
when 'MAY' then 5
when 'JUN' then 6
when 'JUL' then 7
when 'AUG' then 8
when 'SEP' then 9
when 'OCT' then 10
when 'NOV' then 11
when 'DEC' then 12
else 0 end as mth ,&yy as year from Tas a left join ProductDef b on a.campaignid=b.CampId
where substr(b.CampName,1,1) ^="'" and ProdName ^="CANCEL";
quit;
======================================
anyone can help me......
Thx a lot.....
regards,
Yadi Acho....
... View more