In the first case your macro variable's value looks like a date literal to SAS.
'31AUG2018'd
Then your %LET statements make a value that does NOT look like a date literal
31AUG2018
So you either need to change how you USE the value in the second query.
For example add back the quotes and the D suffix.
datepart(startdate) = "&mydate"d
Or how change how you CREATE the new value.
You can make a date literal, like you passed in the macro call.
%let mydate = "%sysfunc(intnx(year,&mydate,-1,same), date9.)"d ;
Or just let the macro variable have the raw number of days since 1960 value.
%let mydate = %sysfunc(intnx(year,&mydate,-1,same));