BookmarkSubscribeRSS Feed
Amy0223
Quartz | Level 8

Could someone help me answer these problems? thank you!

 

Instructions: Please write the SAS code you would use to do each of the following tasks.  The library name should be ONE, the datasets should be named DATA1 (with variables ID, AGE, GENDER, and SMOKE) and DATA2 (with variables REDCAP_ID, Q1, Q2, and Q3).

  1. Write a code to import DATA1.csv file to SAS dataset into the library and remove duplicates.
  2. Write a merge code to keep only the records that are common in both datasets.
  3. Write a macro to create frequency report for all variables in the combined SAS dataset with rtf destination.
  4. Write a code to convert the variable AGE, which is currently a character variable, to numeric and recode to create age categories 0-20, 21-40, 41-60, 61-80, and 81-100.
  5. Write a format code and apply it to the above categories.
1 REPLY 1

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 776 views
  • 0 likes
  • 2 in conversation