For a standard SAS date format, the valid mont names are these:
jan
feb
mar
apr
may
jun
jul
aug
sep
oct
nov
dec
That's why it recognizes oct, but not sept.
Why don't you use the dates that come in a standard format as base for your calculation?
like
month_date = input('01'!!substr(date_char,3),ddmmyy10.);
or
month_date = input(char_date,ddmmyy10.);
month_date = intnx('month',month_date,0,'begin');
@Kurt_Bremser I'm sorry, my level is so low..i try to undertand but it's hard...i still dont succes to class by chronological month...
@Kurt_Bremser; Finally I have changed my source table for the month. I transform the csv table in excel and sas keeps the data I set. I put the date of month in date and in informat MONYY7 and...it's OK!!
I think I had 2 problems: SAS change what I write in csv (no in excel) and the personalised format instead of date format...
Thanks you all a lot to help me...
The Excel file format is probably the worst way to import data into SAS. Especially the old xls is an undocumented, disorganized dungheap that barely works. How often did I need to open MS Office files in OpenOffice just to make them usable again!
.csv is a textual format that can easily be inspected with a text editor to control what is in there and how it was stored.
There are formats in SAS that support local conventions, see SAS NLS Reference Guide.
But I always prefer to use formats that are common on an international level, like YYYY-MM-DD (which is the default format that DB/2 uses for displaying dates).
@Kurt_Bremser, csv is maybe the best...but i turn around in your explication.
My table on csv give me only french date as janv-15, fevr-15...format that SAS dont recognize...so csv put french format that sas can't translate...so I'm blocked.
If you get time, it would be nice to modify my table csv in format SAS know...whether i 'll let in excel...
Thank you
Since there is no NLS informat that can read the MMMM_YY format that you get, you will have to translate manually be converting the french name to a number, and then use a standard format:
data want;
input date_french $;
format date date9.;
date_french = tranwrd(date_french,'janv','01');
date_french = tranwrd(date_french,'fevr','02');
date = input('01-'!!date_french,ddmmyy8.);
cards;
janv-15
fevr-15
;
run;
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.