You might be able to use an NLMNLBRLw.d informat.
data example; x='R$123,456.78'; y= input(x,NLMNLBRL32.); run;
There is a corresponding form to display the values in the same form.
You need the LOCALE system option and an NLS informat.
554 data _null_; 555 x = 'R$100,50'; 556 y = input(x,NLMNY10.); 557 z = input(x,NLMNY10.2); 558 put (y z)(=NLMNY10.2); 559 put _all_; 560 run; y=R$100,50 z=R$100,50 x=R$100,50 y=100.5 z=100.5 _ERROR_=0 _N_=1
My oh my!! Guru @data_null__ How did you know that?
@data_null__ wrote:
You need the LOCALE system option and an NLS informat.
554 data _null_; 555 x = 'R$100,50'; 556 y = input(x,NLMNY10.); 557 z = input(x,NLMNY10.2); 558 put (y z)(=NLMNY10.2); 559 put _all_; 560 run; y=R$100,50 z=R$100,50 x=R$100,50 y=100.5 z=100.5 _ERROR_=0 _N_=1
This was where I started as well. But I remembered that there were some locale specific formats I had encountered (while looking for something else) and thought there might be a Brazil version. So I searched the formats documentation for Brazil an lo and behold, there is one.
You might be able to use an NLMNLBRLw.d informat.
data example; x='R$123,456.78'; y= input(x,NLMNLBRL32.); run;
There is a corresponding form to display the values in the same form.
@ballardw wrote:
You might be able to use an NLMNLBRLw.d informat.
data example; x='R$123,456.78'; y= input(x,NLMNLBRL32.); run;There is a corresponding form to display the values in the same form.
I believe this is the better option because you don't have to fiddle with LOCALE.
Much thanks @ballardw and @data_null__ . I learned something new. Great stuff!!!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.