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?
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
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.
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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.