Proc FCMP Creating a Function and Calling the Function from a DATA Step


/ Published in: SAS
Save to your folder(s)



Copy this code and paste it in your HTML
  1. proc fcmp outlib=sasuser.funcs.trial;
  2.  
  3. Note about code
  4.  
  5. function study_day(intervention_date, event_date);
  6.  
  7. Note about code
  8.  
  9. if event_date < intervention_date then
  10. return(event_date - intervention_date);
  11. else
  12. return(event_date - intervention_date + 1);
  13. endsub;
  14.  
  15. Note about code
  16.  
  17. options cmplib=sasuser.funcs.trial;
  18.  
  19. Note about code
  20.  
  21. data _null_;
  22. start = '15Feb2006'd;
  23. today = '27Mar2006'd;
  24. sd = study_day(start, today);
  25.  
  26. Note about code
  27.  
  28. put sd=;
  29.  
  30. Note about code
  31.  
  32. run;

URL: http://support.sas.com/documentation/cdl/en/proc/59565/HTML/default/a003181727.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.