Hi , i'm trying to do update with cases but sas don't allow me. The 'Case' isn't active. It's not blue but gray and doesn't work. I'm just learnig, can someone tell me what might be the problem?
proc sql;
update anacars.rabat
set (roznica=
case <------------------------------------------
when roznica <1000 then 'Rank1'
select * from anacars.rabat;
roznica<1000 indicates that roznica field would be numeric to be, but then you reassign it a value of 'Rank1' which is character.
As long as you realize that 200>1000 in character language I guess the following is what you want in terms of programming. Logically it doesn't make sense to me.
You have an additional bracket, are missing the end and are also missing the semicolon at the end. In terms of the IDE, I don't believe that the case and other key words are coloured when using it in an update statement, but it still works.
proc sql;
update anacars.rabat
set roznica=
case <------------------------------------------
when roznica <'1000' then 'Rank1' end;
select * from anacars.rabat;
Hi,
Create a new variable rank in your existing data set anacars.rabat then update the same based on roznica variable in proc sql;
Thanks,
data anacars.rabat;
set anacars.rabat;
length rank $ 10.;
run;
proc sql;
update anacars.rabat
set rank=(case when roznica <1000 then 'Rank1' end);
quit;
pwrhaps you only need to move the open (
update anacars.rabat
set roznica= ( select something
You need a new variable because your old variable looks to be numeric and you want a character variable. If it was the same type then you could change it in place.
None of this worked. It's just gray before i even input anything more so i doubt it can see i want to put a character there. And the variable is character anyway. This should work. I read few articles on the subject and the examples look like my update attempt. There are missing values in the column. May this couse the problem?
roznica<1000 indicates that roznica field would be numeric to be, but then you reassign it a value of 'Rank1' which is character.
As long as you realize that 200>1000 in character language I guess the following is what you want in terms of programming. Logically it doesn't make sense to me.
You have an additional bracket, are missing the end and are also missing the semicolon at the end. In terms of the IDE, I don't believe that the case and other key words are coloured when using it in an update statement, but it still works.
proc sql;
update anacars.rabat
set roznica=
case <------------------------------------------
when roznica <'1000' then 'Rank1' end;
select * from anacars.rabat;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: