BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
data new1;
input id ;
datalines;
1
.
1
1
;
run;

data new2;
input id ;
datalines;
1
1
1
;
run;

proc sort data=new1 ;
by id;
run;


proc sort data=new2;
by id;
run;



data left;
merge new1 (in=a) new2 (in=b);
by id;
if  a then output;
proc print;
run ;

Proc sql num;
Select a.*, b.* from new1 a left outer join new2 b on a.id=b.id;
Quit;

data left;
merge new1 (in=a) new2 (in=b);
by id;
if  b then output;
proc print;
run ;

Proc sql num;
Select a.*, b.* from new1 a right outer join new2 b on a.id=b.id;
Quit;




Anandkvn_0-1625485315480.png

 



 

3 REPLIES 3
Amir
PROC Star

Hi @BrahmanandaRao,

 

When I run your code, the error that is shown with the code in the log highlights the word num as the issue:

 121        Proc sql num;
                     ___
                     22
                     202
 ERROR 22-322: Syntax error, expecting one of the following: ;, CHECK, CODEGEN, CONSTDATETIME, DICTDIAG, DOUBLE, DQUOTE, ERRORSTOP, 

 

Removing num allows me to run the code without an error.

 

 

Kind regards,

Amir.

tarheel13
Rhodochrosite | Level 12

It's proc sql number if you want row numbers to be displayed. There is no proc sql num.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 850 views
  • 0 likes
  • 4 in conversation