Help using Base SAS procedures

Invalid argument to function MDY

Reply
N/A
Posts: 0

Invalid argument to function MDY

Hi,

I'm getting the following error. I checked the dates and they all seem valid. Any troubleshooting tips?

Thanks.

Here's the code:

array datesas bdate polio1 polio2 polio3 polio4 polio5 dtp1 dtp2 dtp3 dtp4 dtp5 dtp6
mmr1 mmr2 hib1 hib2 hib3 hib4 hepb1 hepb2 hepb3 var1 var2;
array months bdate_m polio1_m polio2_m polio3_m polio4_m polio5_m dtp1_m dtp2_m dtp3_m
dtp4_m dtp5_m dtpb_m mmr1_m mmr2_m hib1_m hib2_m hib3_m hib4_m hepb1_m hepb2_m hepb3_m
var1_m var2_m;
array days bdate_d polio1_d polio2_d polio3_d polio4_d polio5_d dtp1_d dtp2_d dtp3_d
dtp4_d dtp5_d dtpb_d mmr1_d mmr2_d hib1_d hib2_d hib3_d hib4_d hepb1_d hepb2_d hepb3_d
var1_d var2_d;
array years bdate_y polio1_y polio2_y polio3_y polio4_y polio5_y dtp1_y dtp2_y dtp3_y
dtp4_y dtp5_y dtpb_y mmr1_y mmr2_y hib1_y hib2_y hib3_y hib4_y hepb1_y hepb2_y hepb3_y
var1_y var2_y;
do over datesas;
datesas=mdy(months, days, years);
end;

Here's the log:
NOTE: Invalid argument to function MDY at line 1763 column 14.
SRIDNUM=K059 CHILDNUM=010 RACE=1 ETHNIC=1 P_BIRTH=1 TYPE_REC=1 EXEMPT=0 COUNTY=19 VAR_HX=0 BDATE_M=10 BDATE_D=01 BDATE_Y=03
POLIO1_M=12 POLIO1_D=05 POLIO1_Y=03 POLIO2_M=02 POLIO2_D=13 POLIO2_Y=04 POLIO3_M=04 POLIO3_D=22 POLIO3_Y=04 POLIO4_M=03
POLIO4_D=31 POLIO4_Y=08 POLIO5_M= POLIO5_D= POLIO5_Y= DTP1_M=12 DTP1_D=05 DTP1_Y=03 DTP2_M=02 DTP2_D=13 DTP2_Y=04 DTP3_M=04
DTP3_D=22 DTP3_Y=04 DTP4_M=04 DTP4_D=05 DTP4_Y=05 DTP5_M=04 DTP5_D=31 DTP5_Y=08 DTPB_M= DTPB_D= DTPB_Y= MMR1_M=10 MMR1_D=05
MMR1_Y=04 MMR2_M=03 MMR2_D=31 MMR2_Y=08 HIB1_M= HIB1_D= HIB1_Y= HIB2_M= HIB2_D= HIB2_Y= HIB3_M= HIB3_D= HIB3_Y=
HIB4_M= HIB4_D= HIB4_Y= HEPB1_M=10 HEPB1_D=03 HEPB1_Y=03 HEPB2_M=01 HEPB2_D=19 HEPB2_Y=04 HEPB3_M=07 HEPB3_D=28 HEPB3_Y=04
VAR1_M=10 VAR1_D=05 VAR1_Y=04 VAR2_M=03 VAR2_D=31 VAR2_Y=08 _I_=23 sridnum_error=0 childnum_error=0 race_error=0 ethnic_error=0
p_birth_error=0 type_rec_error=0 exempt_error=0 county_error=0 var_hx_error=0 bdate_m_error=0 bdate_d_error=0 bdate_y_error=0
bdate=15979 bdate_error=0 polio1=16044 polio2=16114 polio3=16183 polio4=17622 polio5=. dtp1=16044 dtp2=16114 dtp3=16183
dtp4=16531 dtp5=. dtpb=. mmr1=16349 mmr2=17622 hib1=. hib2=. hib3=. hib4=. hepb1=15981 hepb2=16089 hepb3=16280 var1=16349
var2=17622 polio1_error=0 polio2_error=0 polio3_error=0 polio4_error=0 polio5_error=0 dtp1_error=0 dtp2_error=0 dtp3_error=0
dtp4_error=0 dtp5_error=0 dtpb_error=0 mmr1_error=0 mmr2_error=0 hib1_error=0 hib2_error=0 hib3_error=0 hib4_error=0
hepb1_error=0 hepb2_error=0 hepb3_error=0 var1_error=0 var2_error=0 polio_dose=0 i=2 dtp_dose=0 mmr_dose=0 hib_dose=0
hepb_dose=0 var_dose=0 _ERROR_=1 _N_=537
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
9931 at 1763:14
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to
missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
1 at 1763:14 Message was edited by: jcis
Super Contributor
Super Contributor
Posts: 3,174

Re: Invalid argument to function MDY

Suggest you add the SAS statement below (within the DO/END, just before the ENDSmiley Wink to reveal the problem cause:

if not datesas then putlog '>diag>' / _all_;


Scott Barry
SBBWorks, Inc.
Super Contributor
Posts: 359

Re: Invalid argument to function MDY

DTP5_M=04 DTP5_D=31 DTP5_Y=08

You have April 31, 2008 which does not exist.
N/A
Posts: 0

Re: Invalid argument to function MDY

: - ) Thank you!!!!
Super Contributor
Super Contributor
Posts: 3,174

Re: Invalid argument to function MDY

Remember, one or more SAS Diagnostic Statements like PUTLOG (new with SAS 9) are a programmer's best friend!!

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 4 replies
  • 1608 views
  • 0 likes
  • 3 in conversation