BookmarkSubscribeRSS Feed
Shrutibhatnagar
Obsidian | Level 7
proc sql;
      create table work.mismatches1 as
      select distinct h.product_id,churn_month
from class1.smb as h
 
    left  join churners as b
    on h.product_id=b.product_id; 
     
          quit;
   
proc sql outobs=200 ;
select product_id ,
case
      when churn_month is not null then '1'
      else '0'
      end as new_column
from work.mismatches1;
quit;
proc sql outobs=200;
select * ,mismatches1.new_column 
from class1.smb 
left join mismatches1 
on smb.product_id=mismatches1.product_id;
quit;
 
ERROR: Column new_column could not be found in the table/view identified with the correlation name MISMATCHES1.
4 REPLIES 4
Kalind_Patel
Lapis Lazuli | Level 10

Error itself says that column new_column is not available in your mismatches1 table, check the table columns of mismatches1.

Shrutibhatnagar
Obsidian | Level 7

the second proc sql contains the mismatches table which gets executed that means the table contains the new_column . where am i wrong ?

Astounding
PROC Star
The second SQL generates a report only. It doesn't create a table. There is no table that contains new_column. To create a table begin with

Create table ........

just like you did in the first sql.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 914 views
  • 1 like
  • 4 in conversation