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

Hi, I'm new with SAS and I have a little problem when I  merge two data set.

when I run the below code, an error 180-322 occur and I dont know why, I check my semicolon and it seems just fine.

plz help.

DATA mer03;
	proc sort data=PAXBAG.baggage_info_1; by Pax_Key;run;
	proc sort data=PDETAIL.pax_detail_1; by Pax_Key;run;
	merge PAXBAG.baggage_info_1 PDETAIL.pax_detail_1;
	by Pax_Key;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

You can't use proc sort in a data-step. Try:

 

proc sort data=PAXBAG.baggage_info_1; 
  by Pax_Key;
run;

proc sort data=PDETAIL.pax_detail_1; 
  by Pax_Key;
run;

data mer03;
	merge PAXBAG.baggage_info_1 PDETAIL.pax_detail_1;
	by Pax_Key;
run;

 

View solution in original post

3 REPLIES 3
gkpf
Fluorite | Level 6

i forget to put the error message.

 

29 merge PAXBAG.baggage_info_1,PDETAIL.pax_detail_1;
_____
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

2 SAS 系統 2019年10月 1日 星期二 下午06時40分50秒

29 by Pax_Key;
__
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

andreas_lds
Jade | Level 19

You can't use proc sort in a data-step. Try:

 

proc sort data=PAXBAG.baggage_info_1; 
  by Pax_Key;
run;

proc sort data=PDETAIL.pax_detail_1; 
  by Pax_Key;
run;

data mer03;
	merge PAXBAG.baggage_info_1 PDETAIL.pax_detail_1;
	by Pax_Key;
run;

 

gkpf
Fluorite | Level 6

Thanks, I solve it simply by moving the data mer03 to the bottom line. @andreas_lds  Thank you so so much

proc sort data=PAXBAG.baggage_info_1; by Pax_Key;
proc sort data=PDETAIL.pax_detail_1; by Pax_Key;
DATA mer03; merge PAXBAG.BAGGAGE_INFO_1 PDETAIL.PAX_DETAIL_1; by Pax_Key; 	
	
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 729 views
  • 2 likes
  • 2 in conversation