Hi:
I'm not clear on what you're trying to do. INTNX is moving a date forward or backward in time. A SAS date value is ALREADY a numeric value. It represents the number of days either before or after Jan 1, 1960 which is internally stored as 0. So Jan 2, 1960 is stored as 1; Jan 3, 1960 is stored as 2; Dec 31, 1959 is stored as -1, etc. A date like Nov 15, 2019 would be stored internally as the number 21868, because it is 21868 days after Jan 1, 1960. So if you use INTNX to MOVE to the date Nov 30, 2019, then the internally stored number for THAT moved value would be 21883.
Do you want to create a character version of your Date_Collect value? INTNX is already creating a numeric variable for you with the value you want. You can run this program to test:
data testnx;
infile datalines;
input Date_Collect : mmddyy.;
lastday_num=intnx('month',Date_Collect,0,'E');
putlog '=== === === ===' _n_= date_collect= date_collect= date9. ' === === === === ===';
putlog '===> ' lastday_num= '(this is internally stored number)';
putlog '===> ' lastday_num= mmddyy10. '(this is formatted value)';
putlog '===> ' lastday_num= date9. '(this is alternative format)';
return;
datalines;
11/15/2019
03/21/2020
;
run;
When I run the above program, this is what I see in the LOG:
Can you clarify what it is you need to do???
Cynthia