@Rahim_221 I don't see how the data you showed in the initial question could possibly be a three-component date. You show it as a single variable, and the values only display month and year:
First data set is as follows, (data1)
Subject_id. Measuredate
ABC0001 8/2017
ABC0002 10/2020
ABC0005 9/2017
The only way that those values could contain a day portion is if they were numeric SAS dates being displayed with a format like mmyys10. For the other data set, you say Measuredate contains only month and year. For that to be true, it would have to be a character (text) value. And if both of those things are true, you can't perform a SAS DATA step merge based on variables of different types. So it would be useful to provide code that will re-recreate the two data sets to help us better understand the issues you are experiencing.
You could try using the data2datastep macro to produce the code required to reproduce your data. For example, this SAS program grabs the source code for the data2datastep macro from the internet and compiles the macro for you. Then, a macro call reads the cars dataset from the sashelp library and generates a program that will re-create 10 observations of the data in the work library. The program is saved to a file named make_cars_data.sas and in home directory (~/😞
/* Get and compile the macro code from GitHub */
filename getmacro url "https://raw.githubusercontent.com/SASJedi/sas-macros/master/data2datastep.sas";
%include getmacro;
filename getmacro clear;
/* Call the macro to do the work */
%DATA2DATASTEP(cars,sashelp,work,~/make_cars_data.sas,10)
If you just leave the last parameter blank, the whole dataset will be re-created. After running that program, the make_cars_data.sas looks like this:
data work.CARS(label='2004 Car Data');
infile datalines dsd truncover;
input Make:$13. Model:$40. Type:$8. Origin:$6. DriveTrain:$5. MSRP:DOLLAR8. Invoice:DOLLAR8. EngineSize:32. Cylinders:32. Horsepower:32. MPG_City:32. MPG_Highway:32. Weight:32. Wheelbase:32. Length:32.;
format MSRP DOLLAR8. Invoice DOLLAR8.;
label EngineSize="Engine Size (L)" MPG_City="MPG (City)" MPG_Highway="MPG (Highway)" Weight="Weight (LBS)" Wheelbase="Wheelbase (IN)" Length="Length (IN)";
datalines4;
Acura,MDX,SUV,Asia,All,"$36,945","$33,337",3.5,6,265,17,23,4451,106,189
Acura,RSX Type S 2dr,Sedan,Asia,Front,"$23,820","$21,761",2,4,200,24,31,2778,101,172
Acura,TSX 4dr,Sedan,Asia,Front,"$26,990","$24,647",2.4,4,200,22,29,3230,105,183
Acura,TL 4dr,Sedan,Asia,Front,"$33,195","$30,299",3.2,6,270,20,28,3575,108,186
Acura,3.5 RL 4dr,Sedan,Asia,Front,"$43,755","$39,014",3.5,6,225,18,24,3880,115,197
;;;;
If you do that for both of your data sets and then share the resulting code to reproduce them here, we can help resolve the problem more quickly.
All the best,
Mark
... View more