BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HitmonTran
Pyrite | Level 9

HI, Can't figure out how to fix this warning message

HitmonTran_0-1612112760089.png

proc sql noprint;
		create table ae as
			select * from adam.adsl as a left join 
				(select count(*) as var_E, usubjid, 'Y' as var_P from ae_summary group by usubjid) as b
				on a.usubjid = b.usubjid
					where actarm in ('Placebo', 'S rS')
					order by actarm, usubjid;
	quit;

 

1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

The  "select *" takes usubjid from both a and b - hence the warning.

 

It looks like the only vars you want from b are var_E and var_P, so change your "select *" to

 

select a.*, b.var_E, b.var_P

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

3 REPLIES 3
mkeintz
PROC Star

The  "select *" takes usubjid from both a and b - hence the warning.

 

It looks like the only vars you want from b are var_E and var_P, so change your "select *" to

 

select a.*, b.var_E, b.var_P

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
novinosrin
Tourmaline | Level 20

Please refer to the appropriate aliases-

select a.* from adam.adsl as a left join

Followed by a.*, var1,var2....varN properly 

 

proc sql noprint;
		create table ae as
			select a.* from adam.adsl as a left join 
				(select count(*) as var_E, usubjid, 'Y' as var_P from ae_summary group by usubjid) as b
				on a.usubjid = b.usubjid
					where actarm in ('Placebo', 'S rS')
					order by actarm, usubjid;
	quit;

The problem is in ambiguous reference for SQL processor to choose and pick the variable from respective tables

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 808 views
  • 0 likes
  • 4 in conversation