I have a raw dataset with 200 observations.There is a date and time variable which records date and time when the patient information was entered into the database.
For every record that is entered the time increments my seconds or minutes .
I need to create a new variable Time which should have the value of the first record entered across all observations of the same date.
eg. if 10 records were entered on jan 2 2010 starting at 11.23.23 (time) all 10 records should have the same value of time.When date changes to jan 3 2010 then the first value of time should repeat across observations and so on.
I am stuck in trying to repeat the observation. Can any one please help.
You commited the carnal sin of first. processing. Not sorting by one variable past what you are looking at the first. of. By moving datalines in your program it no longer works. You are depending on the times being in the correct order before the sort.
Run the below, and you will see the wrong results, you MUST use
BY Name Date Time; to get the correct results all the time.