Hello I would like to connect 2 tables but I do not know how to do it because of the date in text of the second table $ 6 ..Can you help me.
Create a comois variable in the first table, and join on that:
data table1; input comax :$5. coopu :$20. daopu :yymmdd10.; comois = put(daopu,yymmn6.); datalines; 37351 OPUCTC00046D2CW 2019-07-02 42235 OPUCTC0004TOCFP 2019-11-05 42235 OPUCTC0004UJ9RI 2019-12-26 ; data table2; input comax :$5. comois :$6.; datalines; 37351 201907 42235 201911 ; proc sql; create table want as select t1.comax, t2.comois, t1.coopu from table1 t1, table2 t2 where t1.comax = t2.comax and t1.comois = t2.comois; quit;
Please supply example data in usable form (see the above for reference), so we know exactly what you're talking about.
View solution in original post
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Register now!
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.