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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 607 views
  • 0 likes
  • 2 in conversation