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

I am stuck trying to format dates on sas and cant figure out what i'm doing wrong?

Was asked, 

  1. Using DEMOMED, perform the following tasks in a new temporary dataset called TEMP1
    1. Calculate each person’s age as of the date of registration (REG_DATE) using the birth date (BDATE). The age should be an integer value and have the variable name AGE.
    2. Create a new variable called TIMEFUP that is equal to the total amount of time between the date of the registration and June 30, 2008. The value should be in years (decimals are ok). 
    3. You have determined that values of WEIGHTKG greater than the 99th percentile (131 kg) and those less than the 1st percentile (14.5 kg) are data entry errors. Set the weights for subjects with values outside of these limits equal to missing. 
    4. Use the HEIGHTCM and WEIGHTKG variables to calculate BMI for each person (100 centimeters = 1 meter). Run a procedure that will let you make sure BMI was calculated correctly.

      I recall being able to do all of this in one code but I cannot get the first part to work so that I can continue. this is my code for number 1
      data age;
          set demomed;
          reg_date = input(reg_date,MMDDYY10.);
          format reg_date MMDDYY10.;
      run;
      data age; 
      set demomed; 
      age = yrdif(reg_date,bdate);
      run; 
1 ACCEPTED SOLUTION

Accepted Solutions
4 REPLIES 4
saza
Quartz | Level 8
Reg_date is the registration date for each patient. So I believe numeric variable
saza
Quartz | Level 8
Sorry, it is a numeric variable

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 468 views
  • 0 likes
  • 2 in conversation