2
votes

I wrote this code below to complete 2 tasks:

  1. change the value of variable "miscrit" into null if satisfy the condition of "('01JUL2019'd - EXVISDAT + 1) < OverDueDays".
  2. Then delete the columns of targetdays and overduedays from the table.

I wonder if it is possible to write this process with a "proc sql" process since I'm really interested in sql process these days.

Thanks for your help, everyone!

data test4;
    set test3;
    if ('01JUL2019'd - EXVISDAT + 1) < OverDueDays then do;
    miscrit="";
    end;
    drop targetdays overduedays;
run;

I managed to use proc sql to change the value of variable. But don't know how to add the code of the delete of targetdays and overduedays columns from this table.

proc sql;
    update test05
    set miscrit = ""
    where ('01JUL2019'd - EXVISDAT + 1) < OverDueDays
    ;
quit;
1
I think your code should work. Are you getting an error? - Gordon Linoff
What educational, tutorial or reference material are you using to learn SQL ? - Richard
Are you trying to do this for efficiency gains or learning SQL? - Reeza
I'm just trying to use proc sql to solve some particular tasks that I used data procedure to manage before. ;-) To learn some new codes during the problem-solving process. - Binnnnn5

1 Answers

5
votes

Try to use alter table:

proc sql;
    update test05
    set miscrit = ""
    where ('01JUL2019'd - EXVISDAT + 1) < OverDueDays
    ;
    alter table test05
    drop targetdays,overduedays;
quit;