Convert Proc Sql Code to Data Step

Reply
Learner
Posts: 1

Convert Proc Sql Code to Data Step

How can i convert a sql code to data step.

 

proc sql;
     update table1 t1
     set name = (select t2.name from work.table2 t2
                           where t1.value > t2.value_min and t1.value <= t2.value_max);
quit;

 

thanks

Esteemed Advisor
Esteemed Advisor
Posts: 7,263

Re: Convert Proc Sql Code to Data Step

Why do you need to, seems like perfectly good SAS procedure SQL to me?  The datastep version will be longer as you can only merge on variables, not between ranges.  Anyways, post test data of your have tables (in the form of a datastep) as we have nothing to base code one.  The simplest way I can think of offhand is to create a format based on table2 and then put the value from table1 into that format.

Ask a Question
Discussion stats
  • 1 reply
  • 177 views
  • 0 likes
  • 2 in conversation