BookmarkSubscribeRSS Feed
dht115
Calcite | Level 5

Hello, 

 

I do need to use proc sql to merge two dataset. 

I am getting an error when I am using following code. It seems like I am getting error from line 4 (from lptssp.dm a ). 

SAS Code:

 

proc Sql;
	create table _input_dataset_ex as
		select a.usubjid, a.arm,  
			from lptssp.dm a 
				right join (select * from &input_dataset_ex) b 
					on a.usubjid=b.usubjid
				where a.arm ne '';
quit;

Error:

Error log: 

 

MPRINT(D0UNBLIND0EX): proc sql;
NOTE: Line generated by the invoked macro "D0UNBLIND0EX".
218 create table _input_dataset_ex as select a.usubjid, a.arm,
218! from lptssp.dm a right join (select * from &input_dataset_ex) b on a.usubjid=b.usubjid
------ -
22 79
218! where a.arm ne ''; quit; */ ; proc sort data=_input_dataset_ex
SYMBOLGEN: Macro variable INPUT_DATASET_EX resolves to lptssp.ex
MPRINT(D0UNBLIND0EX): create table _input_dataset_ex as select a.usubjid, a.arm, from lptssp.dm
a right join (select * from lptssp.ex) b on a.usubjid=b.usubjid where a.arm ne '';
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, ',', -, /, <,
<=, <>, =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE,
LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.

ERROR 79-322: Expecting a FROM.

 

1 REPLY 1
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

that comma after 'a.arm' is likely the culprit. There shouldn't be a comma before the FROM statement.

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