BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
amng
Calcite | Level 5

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!

1 ACCEPTED SOLUTION

Accepted Solutions
RichardDeVen
Barite | Level 11

Did you try 

 

PARMAXEDUCA = max(FEDUCA,MEDUCA);

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

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.

ed_sas_member
Meteorite | Level 14

Hi @amng 

Could you please post some sample data, the code you used as well as the log?

Best,

RichardDeVen
Barite | Level 11

Did you try 

 

PARMAXEDUCA = max(FEDUCA,MEDUCA);
amng
Calcite | Level 5

thanks! this was the code I was looking for.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 776 views
  • 1 like
  • 4 in conversation