This is Data Step Syntax. The Data Step does not have a Case Statement. Instead, I think you want to write a Select Statement and do something like
select; when (Cp1 = psg and psg-seg = land and cp2 = "") rank = 2; otherwise rank = 1; end;
@animesh123 wrote:If Cp1=psg and psg-seg= land and cp2 ="" then rank=2 else rank=1
Replace IF with CASE WHEN, clean up the syntax after THEN
case when Cp1=psg and psg-seg= land and cp2 ="" then 2 else 1 end as rank
As pointed out by @PeterClemmensen you can't use this in a DATA step, only in PROC SQL
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.