Hi everyone,
I need help for this case :
I have a dataset DATA with columns A, B and C
I want to create a new column D = A + C + G
G does not exist in DATA, thus it will create blank for D. But is there a way to set non existing column (G) default values to 0 and then D will be equal to A + C ?
Thank you,
Gluttony
The SUM() statement will ignore missing values.
The SUM operator (+) will not ignore missing values and sets everything to missing when it's blank.
d_operator = a+c+g;
d_statement= sum(a, c, g);
@Gluttony wrote:
Hi everyone,
I need help for this case :I have a dataset DATA with columns A, B and C
I want to create a new column D = A + C + G
G does not exist in DATA, thus it will create blank for D. But is there a way to set non existing column (G) default values to 0 and then D will be equal to A + C ?
Thank you,
Gluttony
@Gluttony wrote:
Hi everyone,
I need help for this case :I have a dataset DATA with columns A, B and C
I want to create a new column D = A + C + G
G does not exist in DATA, thus it will create blank for D. But is there a way to set non existing column (G) default values to 0 and then D will be equal to A + C ?
Thank you,
Gluttony
D = A + C + 0;
or
D = A + C;
retain g 0;
d=sum(a,c,g);
The SUM() statement will ignore missing values.
The SUM operator (+) will not ignore missing values and sets everything to missing when it's blank.
d_operator = a+c+g;
d_statement= sum(a, c, g);
@Gluttony wrote:
Hi everyone,
I need help for this case :I have a dataset DATA with columns A, B and C
I want to create a new column D = A + C + G
G does not exist in DATA, thus it will create blank for D. But is there a way to set non existing column (G) default values to 0 and then D will be equal to A + C ?
Thank you,
Gluttony
Thank you all for your answers !
Gluttony
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.