I am looking to remove the slashes from a date field. The following format with the "n" returns an error. Any ideas appreciated.
Original data is a date field called month in this format:
20161201
20160801
20161201
20161201
20161001
20161101
20161101
data fix_date;
set work.query_for_objectives_for_reports;
month = intnx('month',month1,0,"BEGINNING");
format month mmddyyn10.;
run;
%LET _CLIENTPROJECTPATHHOST='';
7 %LET _CLIENTPROJECTNAME='';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=PNG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14
15 GOPTIONS ACCESSIBLE;
16 data fix_date;
17 set work.query_for_objectives_for_reports;
18 month = intnx('month',month1,0,"BEGINNING");
19 format month mmddyyn10.;
__________
29
ERROR 29-185: Width specified for format MMDDYYN is invalid.
20
21 run;
What error? Show us the SAS log, not just the ERROR message, but the entire DATA step with subsequent ERROR message and notes. Please paste the log into the window that appears when you click on the {i} icon.
Added log....
Thank you!
From the documentation of the mmddyxw. format:
Interactions When w has a value of from 2 to 5, the date appears with as much of the month and the day as possible. When w is 7, the date appears as a two-digit year without separators. When x has a value of N, the width range changes to 2–8.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.