I have data set loaded by CSV files having student marks (Engilish and Hindi )
But now I want to add English and Hindi marks and assign it to Tot variable
I tried this below code but its not working
Data test; /* Creating new dataset */
set Student; /* Original data set */
Tot = English + Hindi;
Run;
the above code is not working
Kindly help me out on this
Thanks!
Please try below code
Data test; /* Creating new dataset */
set Student; /* Original data set */
Tot = sum(English , Hindi);
Run;
Please try below code
Data test; /* Creating new dataset */
set Student; /* Original data set */
Tot = sum(English , Hindi);
Run;
Thanks Jag, its working
Just to note for future, saying something "does not work" does not provide any information. In this instance, "does not work" means that you have data where one or the other result is missing, when using + a missing in either result means the output will be . (missing). This does not mean it is not working, but just not working as you expect it to, its all in the documentation. In this instance the sum() function ignores missing values, and returns either the one number, or the sum of both of them - again per documentation.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.