Question: I need to create a new variable, called `new_id`, which displays the same value for either same `id` `tasks` or same `location` `tasks`. In this example:

```
Table 1
id Task location
a Task1 lat1
b Task2 lat2 
b Task3 lat1
c Task4 lat3
c Task5 lat4
d Task6 lat5
e Task7 lat5

Table want
id Task Location New_id
a Task1 lat1     a
b Task2 lat2     a
b Task3 lat1     a 
c Task4 lat3     c
c Task5 lat4     c
d Task6 lat5     d
e Task7 lat5     d

```

* `Task1` and `Task3` must have the same `new_id` because they have the same `location`.
* `Task2` and `Task3` must have the same `new_id` because they have the same `id`.

I tried to use a `retain` `data step`. First I sort on location, retain the first.variable, then sort id, retain the first.variable. 

```
proc sort data=table1;
    by location;
data table1_1;
    set table1;
    by location;

    retain new_id_temp;
    if first.location then new_id_temp =id; 
    new_id=new_id_temp;
run;

proc sort data=table1_1;
    by id;
data table1_2;
    set table1_1;
    by id;

    retain id_temp;
    if first.id then id_temp=id; 
    new_id=id_temp;
run;

```

Based on the above code, I still got two different `new_id` and `proc sort` takes lots time if the datasets are large. 

Can anyone help?

Answer: 
To hide:

```
collectionView.hidden = true

```

To show: 

```
collectionView.hidden = false

```

If you want to animate this, you can fade in and fade out.

Fade out:

```
self.collectionView.alpa = 1
UIView.animateWithDuration(1, {
    self.collectionView.alpha = 0
})

```

Fade in:

```
self.collectionView.alpa = 0
UIView.animateWithDuration(1, {
    self.collectionView.alpha = 1
})

```
`collectionView.alpha = 0` I'm not sure what you're trying to achieve UI wise, but there are probably better solutions to stacking collection views.

`collectionView.hidden = true` also achieves the same thing