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.

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 2155 views
  • 1 like
  • 4 in conversation