BookmarkSubscribeRSS Feed
hejhejehej
Calcite | Level 5

The time variable must include the time for the end of the follow-up (31 dec 2013), regardless of the outcome. I am going to use age as a time-scale. So, the lowest age of age at;

* ADHD diagnosis

* emigration

* death

*  end of follow-up (31 dec 2013)

 

How am i supposed to create this age-variable? I have the birth -date variable which is the following;  bfoddat_SAS = input( put(X_bfoddat,8.), YYMMDD8.); the date is presented as: YYYYMMDD, and is numeric. However i don't know how to create the age variable? 

 

*Variable for emigration*;

if MTYP=:'E' then EM=1;

else EM=0;

 

mig_year= (SUBSTR(MDATUM,1,4));

mig_year_num =input(mig_year,4.);

 

age_mig=(mig_year_num-bfodar);

 

*variabel for death*;

 bfoddat_SAS = input( put(X_bfoddat,8.), YYMMDD8.);

  dodsdatum_SAS= input (put(X_dodsdatum, 8.),YYMMDD8.);

 

if dodsdatum_SAS ne . then  age_dod=INT(YRDIF(bfoddat_SAS,dodsdatum_SAS,'actual'));

 

 

 

 

1 REPLY 1
PaigeMiller
Diamond | Level 26

How am i supposed to create this age-variable? I have the birth -date variable which is the following;  bfoddat_SAS = input( put(X_bfoddat,8.), YYMMDD8.);


Wow, this is confusing. You want the years (age) between this bfoddat_SAS variable and December 31, 2013? You have not stated that explicitly. Is that the question? Or have I misunderstood completely?

 

Side comment: there's really no point is adding _SAS to a variable name, every variable you use is a SAS variable. Save yourself some typing and save yourself the possibility of typographical errors by not adding _SAS to variable names.

--
Paige Miller
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
  • 995 views
  • 0 likes
  • 2 in conversation