Hi all,
I have two variables in my dataset, one for father's education (FEDUCA), and one for mother's education (MEDUCA). I would like to create a new variable for parent's education, that is defined by whichever parent's education level is higher. I tried writing this into a DATA statement, but it doesn't look like it's working - when I run a PROC FREQ it shows 217 missing. I should have data on either Mother's or Father's education for all of them, so I'm not sure why it isn't working. Any advice? Thanks!
When your code does not give you the expected result, or gives ERRORs, WARNINGs or NOTEs you do not understand, it is essential to let us see the code and the log from it. Use the </> button for logs, and the "little running man" to post the text by copy/pasting from your SAS interface.
To get the maximum of several (numeric) values, use the MAX function.
Did you try
PARMAXEDUCA = max(FEDUCA,MEDUCA);
thanks! this was the code I was looking for.
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.