Analysis of longitudinal data is one of the most challenging tasks in statistical modeling. In the analysis, it is often necessary to take into account nonlinear response to a set of parameters of interest and correlation between measurements taken from the same individual. In addition, between- and within-subject variation has to be handled properly. An example of addressing these issues is the hierarchical nonlinear model, where parameter estimation can be performed using linearization method. In this paper a new NLMEM SAS/IML macro for hierarchical nonlinear models is proposed. The program uses a portion of the code developed earlier in NLINMIX. NLMEM retains all the benefits of NLINMIX while allowing the systematic part of the model structure to be specified using IML syntax. Consequently, NLMEM allows estimation of models which are not tractable using NLINMIX. In particular, it allows us to address advanced population pharmacokinetics and pharmacodynamics models specified by ordinary differential equations.