Sorry, not much of that post makes sense. Please examine the guidance on presenting a question (and not that is question, not please do this work for me). Post example data in the form of datasteps, and show what you want the output. Why is visit 5 not in valid dataset for example? Visit 2 for 103 does not have an SD data item, yet does in the output?