Data Have: user_id is for one person, who is taking two types of survey below, the first row in red is showing the final time, and length to finish the 1st survey.
The first row in blue is also showing the final time, and length to finish the 2nd survey. The data could continue to 200 different types of surveys.
user_id | survey_date | survey_time | response_date | response_time | length_second |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:01:04 | 64 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:01:04 | 64 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:01:04 | 64 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:01:04 | 64 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:01:03 | 63 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:01:00 | 60 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:01:00 | 60 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:00:52 | 52 |
1 | 11/24/2013 | 14:00:00 | 11/25/2013 | 14:00:52 | 52 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:22:00 | 1320 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:22:00 | 1320 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:22:00 | 1320 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:22:00 | 1320 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:22:00 | 1320 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:21:58 | 1318 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:21:58 | 1318 |
1 | 11/23/2013 | 13:00:00 | 11/25/2013 | 13:21:58 | 1 |
?
Want: to create one ID column for survey, like for red block, survey_num = 01, blue block survey_num = 02... then continue...
Once i have the survey_num column, I will sort the data by survey_num, and length, descending, and keep the first row in each survey, and calculate the mean length, etc....
Thanks for all your help!
What field do you use to identify a survey? The survey_date?
See this link for help as well:
SAS FAQ: How can I create an enumeration variable by groups?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.