I have below Macros *create macro variables for start and end dates for this cycle; %if &season. = spring %then %do; %let start = "01APR%eval(&CurrentYr. - 1)"d; %let end = "30SEP%eval(&CurrentYr. - 1)"d; %end; %if &season. = fall %then %do; %let start = "01OCT%eval(&CurrentYr. - 1)"d; %let end = "31MAR&CurrentYr."d; %end; *Macro variables definitions - to use this macro, specify things in date9 - human readable To use the same values as inputs to the various %get macros, convert them - negates having to add input macro parameters ; *start; %let xstart = %sysfunc(putn(&start.,yymmddn8.)); *end; %let xend = %sysfunc(putn(&end,yymmddn8.)); *cycle; %let cyc = %sysfunc(putn(&start.,yymmn.)); *180 days prior to the earliest possible ddate - palliative; %let xstart180 = %sysfunc(putn(&start.-180,yymmddn8.)); *put latest rpdb postal year into a macro variable proc sql; select max(year) into :RPDByr from rpdb; quit; *double check they resolve properly; %put &xstart.; %put &xend.; %put &cyc.; %put &xstart180.; %put &RPDByr.; I have a dataset called patient ( including one column named "date) and I want to retrieve the observation fall in the %xstart and %xend date, how do I write the code? Thank you very much for your suggestions.
... View more