I Have two variables x and y
x has a format - NEGPAREN15.2
informat - comma 15.
length 8
y variable has format - best12.
Informat - best12.
length -8
both are numeric variables
how to add both of them
i want z variable which is sum of x and y
hhow to do in proc SQL and what format I need to assign to z variable
X Has values like (1,914,456.67)
Y has values like -106213.0235
The format of a numeric variable is only a way to display the value in a report but it does not change anything in the variable so the way to code the sum is as simple as
select x+y as z in sql or z=x+y in a data step.
You can assign any format to z.
CTorres
The format of the variable -- used for appearance only in this case -- will not affect the math. You will need to decide what you want the format of the calculated variable to be though. Example that creates one calculation for each:
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.