libname learn xlsx '/folders/myshortcuts/s2/hosp.xlsx';
proc report data=learn.hosp nowd headline;
column subject AdmitDAte DOB Age;
define AdmitDate/"Admission Date" width=10;
define DOB/width=3 ;
define subject/display width=7;
define Age/computed "Age at admission" ;
compute Age;
Age=round(yrdif(DOB,AdmitDate,'Actual'));
endcomp;
run;
log consists of following statements:
The define usage of a report item is assigned to each variable individually. You have verified that DOB is numeric, therefore its default define usage is ANALYSIS. Character variables have a default usage of DISPLAY. For completeness i like to always specify the define usage on each DEFINE statement - even when i think that it is redundant.
The problem specifically for you in this case is that for report items with a define usage of ANALYSIS their names are not used directly within a compute block. You can read more about this here:
The variable names are used explicitly when the usage is DISPLAY.
The define usage of a report item is assigned to each variable individually. You have verified that DOB is numeric, therefore its default define usage is ANALYSIS. Character variables have a default usage of DISPLAY. For completeness i like to always specify the define usage on each DEFINE statement - even when i think that it is redundant.
The problem specifically for you in this case is that for report items with a define usage of ANALYSIS their names are not used directly within a compute block. You can read more about this here:
The variable names are used explicitly when the usage is DISPLAY.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.