I have longitudinal data and want to examine inter-individual differences in the within functional form.
SAS has a spaghetti plot function with splines, but Stata’s spagplot does not appear to accommodate nonlinear fits.
Thus, I have used the separate command in Stata so as to use the twoway (qfit) command, plotting individuals lines with ||. Data is in long format, but the separate command creates a quasi-wide dataset to use with twoway.

What I am looking for is a loop command to shorten the script, as it is quite long with several individuals in the data set. Imagine the current script looks something like this – – with the exception that instead of scatter, I am using qfit;

graph twoway (scatter tol9 age, msym(i) connect(L)) || (scatter tol45 age, msym(i) connect(L)) || (scatter tol268 age, msym(i) connect(L)) || (scatter tol314 age, msym(i) connect(L)) || (scatter tol442 age, msym(i) connect(L)) || (scatter tol514 age, msym(i) connect(L)) || (scatter tol569 age, msym(i) connect(L)) || (scatter tol624 age, msym(i) connect(L)) || (scatter tol723 age, msym(i) connect(L)) || (scatter tol918 age, msym(i) connect(L)) || (scatter tol949 age, msym(i) connect(L)) || (scatter tol978 age, msym(i) connect(L)) || (scatter tol1105 age, msym(i) connect(L)) || (scatter tol1542 age, msym(i) connect(L)) || (scatter tol1552 age, msym(i) connect(L)) || (scatter tol1653 age, msym(i) connect(L)) || (qfit tol age, lwidth(thick))

Any suggestions on how to use a looping command to mimic the spaghetti pot with non-linear fit in SAS would be greatly appreciated.