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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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