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-2024.png

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.

 

Register now!

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
  • 250 views
  • 0 likes
  • 2 in conversation