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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.