BookmarkSubscribeRSS Feed
lankamanoja
Calcite | Level 5

proc sql noprint;
create table
current as
select market, product_type, chains, facility_name , facility_mpin , coalesce(member_status_flag,new_eff_flag) as Flag, count
from
(
select market,product_type, chains, facility_name , facility_mpin , member_status_flag,
count(member_status_flag) as count

from datloc.FIN360_MBR_ROSTER_RPT_Curr
group by market, product_type, chains, facility_name, facility_mpin , member_status_flag

outer union corr

select market, product_type, chains, facility_name , facility_mpin,new_eff_flag,
count(new_eff_flag) as count
from datloc.FIN360_MBR_ROSTER_RPT_Curr
where new_eff_flag is not missing
group by market, product_type, chains, facility_name, facility_mpin ,new_eff_flag
)
order by market, product_type, chains, facility_name , facility_mpin
;
quit;

 

 

 

Log:

NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24
25 GOPTIONS ACCESSIBLE;
26 proc sql noprint;
27 create table
28 current as
29 select market, product_type, chains, facility_name , facility_mpin , coalesce(member_status_flag,new_eff_flag) as Flag,
29 ! count
30 from
31 (
32 select market,product_type, chains, facility_name , facility_mpin , member_status_flag,
33 count(member_status_flag) as count
34
35 from datloc.FIN360_MBR_ROSTER_RPT_Curr
36 group by market, product_type, chains, facility_name, facility_mpin , member_status_flag
37
38 outer union corr
39
40 select market, product_type, chains, facility_name , facility_mpin,new_eff_flag,
41 count(new_eff_flag) as count
42 from datloc.FIN360_MBR_ROSTER_RPT_Curr
43 where new_eff_flag is not missing
44 group by market, product_type, chains, facility_name, facility_mpin ,new_eff_flag
45 )
46 order by market, product_type, chains, facility_name , facility_mpin
47 ;
ERROR: Ambiguous reference, column product_type is in more than one table.
ERROR: Ambiguous reference, column chains is in more than one table.
ERROR: Ambiguous reference, column product_type is in more than one table.
ERROR: Ambiguous reference, column chains is in more than one table.
WARNING: Column named product_type is duplicated in a select expression (or a view). Explicit references to it will be to the first
one.
WARNING: Column named chains is duplicated in a select expression (or a view). Explicit references to it will be to the first one.
ERROR: The following columns were not found in the contributing tables: member_status_flag, new_eff_flag.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.

1 REPLY 1
PaigeMiller
Diamond | Level 26

Whenever you get an error in the log (that's 100% of the time), you need to show us the ENTIRE log for this DATA step or PROC. Please copy the ENTIRE log for this DATA step or PROC and then paste it into the window that appears when you click on the </> icon.

PaigeMiller_0-1663012019648.png

 

Additional comment:

 

data datloc.FIN360_MBR_ROSTER_RPT_Curr;
set datloc.FIN360_MBR_ROSTER_RPT_Curr;

 

it is usually considered to be a poor programming practice to overwrite your data set with a new data set of the exact same name, this erases the original data set (which you might need to go back to at some point). Better would be this:

 

data datloc.FIN360_MBR_ROSTER_RPT_Curr;
set FIN360_MBR_ROSTER_RPT_Curr2;

 

 

 

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 250 views
  • 0 likes
  • 2 in conversation