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
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!
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.