BookmarkSubscribeRSS Feed
peppapig
Calcite | Level 5

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_idsurvey_datesurvey_timeresponse_dateresponse_timelength_second
111/24/201314:00:0011/25/201314:01:0464
111/24/201314:00:0011/25/201314:01:0464
111/24/201314:00:0011/25/201314:01:0464
111/24/201314:00:0011/25/201314:01:0464
111/24/201314:00:0011/25/201314:01:0363
111/24/201314:00:0011/25/201314:01:0060
111/24/201314:00:0011/25/201314:01:0060
111/24/201314:00:0011/25/201314:00:5252
111/24/201314:00:0011/25/201314:00:5252
111/23/201313:00:0011/25/201313:22:001320
111/23/201313:00:0011/25/201313:22:001320
111/23/201313:00:0011/25/201313:22:001320
111/23/201313:00:0011/25/201313:22:001320
111/23/201313:00:0011/25/201313:22:001320
111/23/201313:00:0011/25/201313:21:581318
111/23/201313:00:0011/25/201313:21:581318
111/23/201313:00:0011/25/201313:21:581

?

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!

1 REPLY 1
Reeza
Super User

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?

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 366 views
  • 0 likes
  • 2 in conversation