Tips:Local format using NLS and Locale

From sasCommunity

Jump to: navigation, search

Peter Crawford came up with this suggestion of using the NLMNY format in handling formats outside of the United States. To use this approach, one must first change the locale settings which can be achieved by using the locale system option.

After using this option, one can then apply the currency informat and format easily on data. Below is an example of the currency coding.

options locale = English_UnitedKingdom;
 
data _null_;
  a = PUT(1234.1234,NLMNYI32.2);
  b = PUT(-1234.1234,NLMNYI32.2);
  c = PUT(1234.1234,NLMNY32.2);
  d = PUT(-1234.1234,NLMNY32.2);
  reading = input( "£12,345.67", nlmny20. ) ;
  put _all_;
  put 'in dollar style ' reading dollar12.2 ;
run;
 
a=GBP1,234.12 b=-GBP1,234.12 c=£1,234.12 d=-£1,234.12

For Nation Language Support (NLS) for SAS in other countries, on: dates and times, number and money formats and informats, sort order and message language, (and so on) see http://support.sas.com/documentation/cdl/en/nlsref/61893/HTML/default/nls-overview.htm

Submitted by Peter Crawford and Murphy Choy. Contact me at my Discussion Page.

Personal tools