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?
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.