BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kurt_Bremser
Super User

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');
peter2
Obsidian | Level 7

@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...

peter2
Obsidian | Level 7

@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...

Kurt_Bremser
Super User

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).

peter2
Obsidian | Level 7

@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

 

 

Kurt_Bremser
Super User

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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 20 replies
  • 2370 views
  • 3 likes
  • 4 in conversation