Hi all,
I'm trying to see if each person had visited different location for each observation and if there was a location they frequently visited.
The data looks like this (along with other variables like date, description of the visit...)
Name Location
Name1 location_A
Name1 location_B
Name1 location_C
Name2 location_D
Name2 location_D
Name2 location_D
Name2 location_E
Name3 location_F
Name3 location_G
So I would like to know if the people in my data set usually go to the same place (in the case of Name2 that went to location_B 75% of the time) or not (in the case of Name1 that went to three different places three different times). Is there any good way to see this with a SAS code?
I know it's not a good data question, but I thought I would ask the experts anyways.
Thank you,
Give Summary Tables in Enterprise Guide a try. Set Name and Location as your Classification variables, and on the table builder get it looking like this:
When you run it, you should see a table with the correct numbers. Then in the Results tab, have EG save it to a dataset. The dataset should look like this:
Hi Tom,
Thank you for your solution. This is what I would normally do - but I failed to mention that my data contains at least 700,000 people, each with 5-20 visits.
Any good solution for such data?
Thanks,
I wouldn't get too concerned...SAS plays in the big boy leagues.
Just turn off all of your report output options in EG. I spun up some test data that I think matches your profile (8 million records), and the Summary Tables step ran in about 30 seconds.
Tom
Here's a quick and dirty report that might be good enough:
proc freq data=have;
tables name * location / missing list;
run;
Well, maybe not for 700K people. What would you consider to be an acceptable report for that? This program will print something for each NAME, which might be too much. But if that's not a good solution, then what is? If you can design the report, somebody can certainly program it.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.