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-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!

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
  • 3 replies
  • 576 views
  • 0 likes
  • 4 in conversation