Lieutenant Commander Data's first ability resolves before the spell that caused it to trigger. It resolves even if that spell is countered or otherwise leaves the stack without resolving.

Artwork
Loading artwork…
Lieutenant Commander Data
Star Trek · #69 · EN
Nonfoil—Foil—
Card rules
Whenever a player casts a noncreature spell, put a +1/+1 counter on Lieutenant Commander Data.
1, Remove three counters from among creatures you control: Draw a card.
2/2
"Reasoning from the general to the specific. Is that not the very definition of deduction? Is that not the way Sherlock Holmes worked?"
Mythic · Illustrated by Irvin Rodriguez
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Future Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pioneer Legal
Standard Legal
Standard Brawl Legal
Timeless Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
PreDH Not Legal
Premodern Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
The counters you remove to pay the cost of Lieutenant Commander Data's last ability don't have to be the same kinds of counters, and they don't all have to be on the same creature. For example, you could remove a stun counter from one creature, a -1/-1 counter from another creature, and a +1/+1 counter from a third creature.