BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rhapsody
Calcite | Level 5

I have the following code

 

 

%let date=31MAR2019;

data _null_;
date_var="&date."d;
format date_var date9.;
month_name=put(date_var, monname.);
call symputx('month_name',month_name);
run;
%put &month_name;

 

 

This generates the the month name March. But I want the month name in Swedish, which is Mars

 

Anyone knows how to do this?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

SAS provides NLS-capable format equivalents for the standard formats:

%let date=31MAR2019;
options locale=sv_SE;
data _null_;
date_var="&date."d;
format date_var date9.;
month_name=put(date_var, nldatemn10.);
call symputx('month_name',month_name);
run;
%put &month_name;

Log excerpt:

35         %put &month_name;
mars

Documentation (Maxim 1!) is found at

documentation.sas.com

SAS® 9.4 and SAS® Viya® 3.4 Programming Documentation

National Language Support (NLS)

Formats for NLS

View solution in original post

2 REPLIES 2
SASKiwi
PROC Star

This link for the EURDFMNw. format should help: https://documentation.sas.com/?docsetId=nlsref&docsetTarget=p145pxsliwoaogn146kcyceye2q2.htm&docsetV...

 

The documentation suggests swapping out the first 3 letters for the language you want namely: SWEDFMNw.

 

 

Kurt_Bremser
Super User

SAS provides NLS-capable format equivalents for the standard formats:

%let date=31MAR2019;
options locale=sv_SE;
data _null_;
date_var="&date."d;
format date_var date9.;
month_name=put(date_var, nldatemn10.);
call symputx('month_name',month_name);
run;
%put &month_name;

Log excerpt:

35         %put &month_name;
mars

Documentation (Maxim 1!) is found at

documentation.sas.com

SAS® 9.4 and SAS® Viya® 3.4 Programming Documentation

National Language Support (NLS)

Formats for NLS

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 698 views
  • 0 likes
  • 3 in conversation