you need to fix get the incoming data so that the variables are the same type. If a variable is defined in two datasets or incoming process's as both character and numeric they will not stack.
I fix it. now I need to make sure the date in the (demographic) file match with the (disease) file.
The date in the (demographic) file looks like this (28MAY2016),
while the date in the (disease) file looks like this (01/29/2011).
I tried to check the format of the date I have with this code
data library.E11;
a=fmtinfo('best','cat');
put a=;
run;
but I got this error
ERROR 68-185: The function FMTINFO is unknown, or cannot be accessed.
I'm working on SAS 9.4 TS Level 1M0
when I applied this code
data library.E111;
set library.E1;
Visit_Date= input(DIAG_DT_TM,anydtdte32.);
Format Visit_Date date9.;
drop DIAG_DT_TM;
run;
I got this response in the log
4113 data library.E111;
4114 set library.E1;
4115 Visit_Date= input(DIAG_DT_TM,anydtdte32.);
4116 Format Visit_Date date9.;
4117 drop DIAG_DT_TM;
4118 run;
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
4115:19
That's mean (library.E1) has a numeric date. right?
I'm pretty positive that all the dates I have right now are numerical. So, when I apply the code below to specify the year, it gave me only the year, in the past when it was a character, it gave me missing values. Do you get what I mean?
Here is the code that I used to only specify the year variable.
data EALLB;
set EALLA;
year=year(DIAG_DT_TM);
RUN;
^
this is to prove that I have numeric dates NOT character.
but still, I don't know why when I want to merge and match the (visit date), it only gives me 6 observations, which I checked manually and there are a lot of matched dates between the two files.
I'm lost. @Reeza
I uploaded the datasets if you wanna have a look.
Thanks @Reeza
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.