I am looking to merge on two variables, rather than just one. I want to match on both and ID number and a Date.
Thanks
data Final; merge Gts_7 (in=in1) Merged5; by ID Date; if in1; run;
You have to sort your data first.
proc sort data=Merged5;
by ID Date;
run;
What problems are you having?
@NickA1 wrote:
ERROR: BY variables are not properly sorted on data set WORK.MERGED5.
in1=0 Date=. Govt_Yield=. GT=30 Cusip=915217WX7 Yield=. FIRST.GT=0 LAST.GT=0 FIRST.Date=0
LAST.Date=0 _ERROR_=1 _N_=42
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 6 observations read from the data set WORK.GTS_7.
NOTE: There were 38 observations read from the data set WORK.MERGED5.
WARNING: The data set WORK.FINAL may be incomplete. When this step was stopped there were 5
observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.04 seconds
Seems like the error message (which I have highlighted in red) is relatively clear.
You have to sort your data first.
proc sort data=Merged5;
by ID Date;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.