I'm working on an assignment & not allowed to use PROC SQL. I imported data from two csv files & renamed columns at the same time (see code below) but when I tried to PROC APPEND the two tables, there's an issue with the date format. When I PROC CONTENTS I get the following info:
Work.2019data: Variable:date Type:Num Length:8 Format/Informat:MMDDYY10 When I open this file in notepad, the dates appears like this: 12/31/2019
For the second table:
Work.2020data: Variable:date Type:Num Length:8 Format/Informat:YYMMDD10 But when I open this file in notepad, the dates appears like this: 2020-11-16
PROC IMPORT
DATAFILE= "&export_mtl/2019data.csv"
OUT= WORK.2019data
(RENAME=(new_cases=nouveaux_cas
new_deaths=nouveaux_deces
new_tests=nouveaux_tests
total_tests=nb_total_tests
female_smokers=femmes_fumeuses
male_smokers=hommes_fumeurs
))
DBMS= csv
REPLACE;guessingrows=10000;
GETNAMES= YES;
RUN;
PROC IMPORT
DATAFILE= "&export_mtl/2020data.csv"
OUT= WORK.2020data
(RENAME=(new_cases=nouveaux_cas
new_deaths=nouveaux_deces
new_tests=nouveaux_tests
total_tests=nb_total_tests
female_smokers=femmes_fumeuses
male_smokers=hommes_fumeurs
))
DBMS= csv
REPLACE;guessingrows=10000;
GETNAMES= YES;
RUN;
What's the simplest way to cast the date in the 2020data table so that I can concatenate the two tables after? I've seen so many ways of doing this & tried them with no luck.