Code
data total_sales;
input Date mmddyy10. +2 Amount comma5.;
datalines;
09/05/2000 1,382
10/19/2000 1,235
11/30/2000 2,391
;
run;
Output
1 | 14858 | 382 |
2 | 14902 | 235 |
3 | 14944 | 391 |
DATA TOTAL_SALES;
FORMAT DATE MMDDYY10.;
INPUT DATE :MMDDYY10. AMOUNT :COMMA5.3;
DATALINES;
09/05/2000 1,382
10/19/2000 1,235
11/30/2000 2,391
;
RUN;
SAS stores dates as number of days since a certain timepoint. The number you are seeing is the raw value, i.e. the number of days since the cuttoff. You need to format this number of days into the display type you want.
The smallest change possible: change +2 to +1. +2 moves you past the first digit, to the comma.
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.