Hello everyone,
I am attempting to compute a new variable (BMI) with existing observations of weight and height. I have two questions.
1. how do I report BMI as "missing" if either the height or weight variables are missing for a subject?
2. I tried to calculate it but I don't know how to access the newly created data set that I believe is supposed to result of this command.
Here is a photo of the code and log. Thank you for any help!
I think you should take this free course on SAS Programming 1: Essential
https://support.sas.com/edu/schedules.html?ctry=us&crs=PROG1
Otherwise to your question, you can use If statment to handle BMI in case of missing values.
Go to Work library and find your output dataset. Or you can point your output dataset to PI library.
Code and logs are TEXT. Please post as such. Don't expect the people here to re-type from pictures.
Also supply example data. Use the macro from https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to convert your dataset P1.PROJECT1 to a data step, and post that according to https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce, so we can recreate your dataset for testing with copy/paste and submit.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.