Humor can be dissected, as a frog can, but the thing dies in the process and the innards are discouraging to any but the purely scientific mind.
E. B. White (1899-1985) American author, critic, humorist [Elwyn Brooks White]
“The Preaching Humorist,” The Saturday Review of Literature (1941-10-18) [with Katherine White]
(Source)
The apparent origin of "Analyzing humor is a bit like dissecting a frog: You learn how it works but you end up with a dead frog" (and variants).
Also attributed to Mark Twain (not found in his writing) and André Maurois (who said something similar in 1960). See here for more discussion.