I have a daset like this
| IncidentID | MENSEX | MaleSexPartners |
| 1 | 1 | 0 |
| 2 | 10 | 0 |
| 3 | 1 | 1 |
| 4 | 1 | 0 |
| 5 | 2 | 0 |
| 7 | 5 | 5 |
| 10 | 5 | 0 |
| 12 | 5 | 0 |
| 13 | 5 | 0 |
I would like to copy variable from MENSEX variable to malesexpartners variable ONLY if malesexpartners's value is "0". I want my data to look like this
| IncidentID | MENSEX | MaleSexPartners |
| 1 | 1 | 1 |
| 2 | 10 | 10 |
| 3 | 1 | 1 |
| 4 | 1 | 1 |
| 5 | 2 | 2 |
| 7 | 5 | 5 |
| 10 | 5 | 5 |
| 12 | 5 | 5 |
| 13 | 5 | 5 |
Please help me. Thank you
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.