data studypop;
set b;
*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);
*variable 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'));
* age when subject recived ADHD-diagnosis*;
datum_ADHD_SAS = input( put(datum_adhd,8.), YYMMDD8.);
if datum_ADHD_SAS ne . then age_diag=INT(YRDIF(bfoddat_SAS,datum_ADHD_SAS,'actual'));
*age when subject got stimulant prescription *;
FDATUM_ADLM_sas = input( put(FDATUM_ADLM,8.), YYMMDD8.);
if FDATUM_ADLM_sas ne . then age_LM=INT(YRDIF(bfoddat_SAS,FDATUM_ADLM_sas,'actual'));
*age at end of follow-up*;
enddate=MDY(12,31,2013);
age= INT(YRDIF(bfoddat_SAS,enddate,'actual'));
run;
data ADHD;
set studypop;
/*variable for age when reciving ADHD-diagnosis AND/OR age when reciving stimulant prescription*/
Age_adhd = (age_LM OR age_diag);
/* Variable for age at exit (time_var) */
time_var=min(age_adhd, age_mig, age_dod,age);
/* If a child has emigrated and then immigrated again, it might have an ADHD diagnosis that happens after age at exit.
This is recoded as no ADHD, since the ADHD happens after end of follow-up for that child. */
if age_ADHD > time_var then ADHDD=0;
/* Exclude children with an ADHD diagnosis before 3 years of age */
if 0< age_ADHD < 3 then delete;
/* Define age at entry, which is 3 years */
age_entry=3;
run;
proc phreg data=adhd;
class CH_ICD_CAT (ref='4');
model time_var*ADHDD(0) = CH_ICD_CAT /RL entrytime=Age_entry;
ods output ParameterEstimates = estimates CensoredSummary = censored;
run; 382 data ADHD ;
383 set studypop;
384
385 age_ADHD=(age_LM OR AGE_DIAG);
386
387 /* Variable for age at exit (time_var) */
388 time_var=min(age_adhd, age_mig, age_dod,age);
389
390 /* If a child has emigrated and then immigrated again, it might have an ADHD diagnosis
390! that happens after age at exit.
391 This is recoded as no ADHD, since the ADHD happens after end of follow-up for that child.
391! */
392 if age_ADHD > time_var then ADHDD=0;
393
394 /* Exclude children with an ADHD diagnosis before 3 years of age */
395 if 0< age_ADHD < 3 then delete;
396
397 /* Define age at entry, which is 3 years */
398 age_entry=3;
399
400 run;
NOTE: There were 2863330 observations read from the data set WORK.STUDYPOP.
NOTE: The data set WORK.ADHD has 2767319 observations and 247 variables.
NOTE: DATA statement used (Total process time):
real time 9.03 seconds
cpu time 5.23 seconds
401
402 proc phreg data=adhd;
403 class CH_ICD_CAT (ref='4');
404 model time_var*ADHDD(0) = CH_ICD_CAT /RL entrytime=Age_entry;
405 ods output ParameterEstimates = estimates CensoredSummary = censored;
406 run;
NOTE: 2767319 observations were deleted due either to missing or invalid values for the entry,
time, censoring, frequency, offset or explanatory variables or to invalid operations in
generating the values for some of the explanatory variables.
ERROR: There are no valid observations for the analysis.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PHREG used (Total process time):
real time 4.29 seconds
cpu time 4.29 seconds
WARNING: Output 'CensoredSummary' was not created. Make sure that the output object name,
label, or path is spelled correctly. Also, verify that the appropriate procedure
options are used to produce the requested output object. For example, verify that
the NOPRINT option is not used.
WARNING: Output 'ParameterEstimates' was not created. Make sure that the output object name,
label, or path is spelled correctly. Also, verify that the appropriate procedure
options are used to produce the requested output object. For example, verify that
the NOPRINT option is not used.
I am sorry for not being clear enough. This is the log statement that i recived when running the code.
... View more