The effect of behaviors on attitudes was vividly demonstrated in Zimbardo's (1971) classic study of a simulated prison.
To add, Stanford Prison Experiment’s aim was to investigate how readily people would conform to the roles of guard and prisoner in a role-playing exercise that simulated prison life.