DATA Step, Macro, Functions and more

Select Records In Group By

Reply
Contributor sss
Contributor
Posts: 65

Select Records In Group By

Hi All,

I am struck up in interesting scenario. I have dataset which has three variable query,brand and datetime variable.

In query variable, the use has maid a search using some brand. he can make same search query using other brand as well. ( the  "AIM express" search in attached fie).

there are few condition are the select the records.

1. the search should be maid in more the one brand .

2. the search should be maid with in 10 mins of first search.

3. group is on query variable.

4. same query can be maid using different brands, i need only those query which are maid in more then one brand and time diff of max 10 mins.

PFA

it would be great help for the solution.

Attachment
Super User
Posts: 10,466

Re: Select Records In Group By

Questions:

     What environment are you working in? Enterprise Guide, BI, DI, something else?

1. the search should be made in more the one brand .

     Within all brands or just a subset of brand?

2. the search should be made with in 10 mins of first search.

     "First search"? Do you mean to keep track of when a user entered a query and then use that as a comparison time?

3. group is on query variable.

     If this is an SQL query then the syntax is: group by query

4. same query can be made using different brands, i need only those query which are made in more then one brand and time diff of max 10 mins.

     I think you need to provide an example of what have for input here. It looks like you are again trying to keep track of the time that a query was submitted.

Contributor sss
Contributor
Posts: 65

Re: Select Records In Group By

Hi Thank you for connecting.

I am working on BASE SAS.

Ans 1. Within all brands

And 2. yes. your thought is correct.

Ans 3. Yes . the grouping is done on Query variable

Ands 4. here is an example same query is searched on AOL bing and Google the first quiry was done at 14:10:59 and last query was done at 14:23:56 .  so want to select 3 records. If query was done on any of this one brand then that record is to be drop and if query is done on more then one brand and time diff is more then 10 mins the we need to compare rest of obs and produce the out put

it will be OK is diff in time is 15 mins. its just a research.

AIM EXPRESSAOL19MAR14:22:37:49
AIM EXPRESSAOL14JUN14:23:56:49
AIM EXPRESSBING04APR14:15:35:55
AIM EXPRESSGOOGLE11MAR14:10:59:57
AIM EXPRESSGOOGLE05JUN14:20:54:36
Ask a Question
Discussion stats
  • 2 replies
  • 235 views
  • 1 like
  • 2 in conversation