Skip to main content

Posts

Showing posts from March, 2016

Predicting height from growth curves

My eldest daughter said: I hope my height will improve to become 170cm (5'7'')

Let's have a look at growth curves. Growth accelerates several times during adolescence, so we can only guess. Above a growth curve for Danish females and a fair prediction she will become disappointed (by an inch). A predicted median height is 173cm (5'8'') calculated using the height of her mother and my own height ((father's height minus 13) + mothers height)/2.
More precise predictions can be made through combination of anthropometric measures.

Generate indicators in SAS based on factor variables

Generating indicators from factor variable defined in SAS datafile using a generic procedure in three steps. The code is easy to modify to suite more complicated needs.
Produce table with factor levelsUse data step to generate programAppend indicators by running SAS data step using %includeAn example of generative programming...

proc sql; 
  create table levels_data_set_name as 
  select distinct factor_variable_name as indicator_name 
  from input_data_set_name; 
quit; 

data _NULL_; 
  file 'C:\PATH_TO_GENERATED_SAS_PROGRAM\indicators.sas';     
  put 'data somelib.indicator_enriched_data_set;'; 
  put 'set input_data_set_name;'; 
run; 

data _NULL_; 
set levels_data_set_name; 
  file 'C:\PATH_TO_GENERATED_SAS_PROGRAM\indicators.sas' MOD; 
  length char_var $256; 
  char_var='ind'||strip(indicator_name)||'='; 
  put char_var; 
  char_var='('||strip(factor_variable_name)||' EQ '||strip(indicator_name)||'");'; 
  put char_var; 
ru…