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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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