Hi!
I have one question.
I have a numers in commax30. format which are saved in macro variable. (e.g. first numer= 35.258.698, second numer=58.258.369 an so one.., every numer contains 2 dots)
When i try to summarize this two or more numer i get an error bescause numbers has 2 dots.
I tried with more combinations and i do not know how to resolve this problem.
The numbers must be in defined formats commax30. and i do not want define duplicate macro variable just for summarizing.
Does anyone have any idea.
For example:
%let var1=25.598.659;
%let var2=32.589.124;
%let sum=%syseval(&var1+&var2);
%put ∑
Thx for help.
Mladen
Please help me understand why would a number have 2 dots. Can this 25.598.659 be assumed as 25,598,659?
Hi!
Because my client wants result in this format. 25,598,659 is not acceptable format for my reports.
I can define duplicate macro variable but this is too complicated.
So, i try to fine more elegant solution.
Thx for questions.
Couldn't you just use the commaxw.d format for your reports? see:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000200612.htm
Is it basically the european format for a number, decimal instead of comma?
I think Hima's question needs to be answered, otherwise how do the numbers add together, ie Do all numbers have 2 periods and do all have 8 digits?
Assuming you can't just use the commax format in your final report and store intermediaries in the north american standard notation my suggestion would be to convert to comma notation and the reconvert back to commax format.
%let var1=25.598.659;
%let var2=32.589.124;
%let cvar1=%sysfunc(inputn(&var1, commax30.));
%let cvar2=%sysfunc(inputn(&var2, commax30.));
%put &var1 &var2 &cvar1 &cvar2;
%let sum=%sysfunc(putn(%sysevalf(&cvar1 +&cvar1), commax30.));
Since you are creating the macro variables as text somewhere DON'T use a format until final output.
Hi!
Thanks everyone for help and suggestions.
I will try some of this solutions.
Thx, one more time.
Mladen
Hi,
what about when we have commaxw.d, when d>0?
for example
%let var1=25.598.659,6;
%let var2=32.589.124,9;
Thanks in advanced.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.