I have columns named dairy_ee, fruit_ee, oils_ee, etc. They are either a 0 or 1 but there are some blank spaces. I want to fill these columns with a 0 or 1 based on another variable group. It looks something like this: Group dairy_ee fruit_ee oils_ee 1 0 1 0 1 . . . 2 0 1 0 2 . . . 3 1 1 0 3 . . . 4 0 0 0 4 . . . 4 . . . Thank you!
... View more
I have two data sets WORK and SUMS. WORK is my working data set and SUMS is half the size and contains the same exact IDs as WORK. SUMS has the variables I want for the observations I was analyzing, so I want to merge the data sets and replace the observations in WORK with those in SUMS. Example of a small portion what they look like: WORK SEQN alcohol legumes meat 10001 1.5 3.0 2.3 10002 1.4 2.3 3.5 10003 0 5.0 2.3 10004 3.0 2.0 2.0 SUMS SEQN alcohol legumes meat 10002 2.2 3.3 5.0 10004 5.5 3.8 2.2 So the observations in the SUMS would replace the existing ones in WORK. Thanks for your time!
... View more
Thank you! The first code you sent kept deleting all observations for some reason but the second one worked! I am just interested in the food groups eaten by participants for right now.
... View more
Hi all, I'm analyzing NHANES data and have combined day 1 food intake and day 2 food intake into their own observation rows. Now I want to combine those rows into 1 row that shows days 1 and 2 intakes for each participant. For example: SEQ DR1T_G_WHOLE DR1T_G_REFINED DR2T_G_WHOLE DR2T_G_REFINED 1 5.2 4.01 1 .8 1.2 2 1.0 2.2 2 2.5 0 How would I combine the 1s so all the cells are filled? I also have thousands of SEQ IDs. I've tried proc means data= test noprint nway; class SEQ; var ...; output out= sums; run; This led to a min max and std showing up as well, is there a way to remove those?
... View more