BookmarkSubscribeRSS Feed
PierreYvesILY
Pyrite | Level 9

Dear SAS experts,

 

I Need to convert the numbers of the month in the year into the month names, in german:

1 => Januar

2 => Februar

3=> März

etc

 

I know that ther is such a Format like deudfmn10. but I can't write the appropriate Code.

I Need the correction of this, wehre date is the number of the month

Monat = tranwrd(put(date,deudfmn10.),'ä','ae');

 

How can I get this?

2 REPLIES 2
Kurt_Bremser
Super User

Look here:

data _null_;
do mon = 1 to 12;
  put mon NLSTRMON10.;
  put mon NLSTRMON10.1;
  put mon NLSTRMON10.2;
  put mon NLSTRMON10.3;
  date = mdy(mon,1,2020);
  put date NLDATEMN10.;
end;
run;
Tom
Super User Tom
Super User

That format needs a DATE, not a month, and defaults to right aligned.

Try this:

data _null_;
do mon = 1 to 12;
  date = mdy(mon,1,2020);
  length monat $10;
  Monat = tranwrd(put(date,deudfmn20.-l),'ä','ae');
  put mon= date= date9. monat=;
end;
run;
mon=1 date=01JAN2020 Monat=Januar
mon=2 date=01FEB2020 Monat=Februar
mon=3 date=01MAR2020 Monat=Maerz
mon=4 date=01APR2020 Monat=April
mon=5 date=01MAY2020 Monat=Mai
mon=6 date=01JUN2020 Monat=Juni
mon=7 date=01JUL2020 Monat=Juli
mon=8 date=01AUG2020 Monat=August
mon=9 date=01SEP2020 Monat=September
mon=10 date=01OCT2020 Monat=Oktober
mon=11 date=01NOV2020 Monat=November
mon=12 date=01DEC2020 Monat=Dezember

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 685 views
  • 1 like
  • 3 in conversation