Category Archives: Work

Compressing Long Lists of Variables for Tidier SPSS Syntax

You just pasted a long list of variables into your SPSS syntax that you want to delete from or rename in your dataset.

Maybe you normally just leave it as is or maybe you manually compress the list with a committed effort of backspaces and spaces. Both options I find quite frustrating: you either deal with the laggy scrolling of SPSS as you move up and down your syntax for the former (which is even more frustrating if you have thousands of variables and you’re still working on the syntax) or you let it consume your time as you meticulously work through the list for the latter.

Well, I’m here to tell you about one way I’ve found to quickly compress long lists of variables.

Step 1: Copy and paste your variables into Microsoft Word.

Step 2: Go to Edit -> Find -> Replace…

Step 3: In the Find menu, select “Paragraph Mark” and within the Replace menu, manually press the spacebar once to effectively replace paragraph marks with a single blank space (you could also use the dropdown menu to select “Nonbreaking Hyphen” or “Nonbreaking Space”). Press Replace All.

Formatting marks (the blue markings) are shown for clarification
Formatting marks (the blue markings) are shown for clarification

Step 4: With the list now compressed into a single paragraph, you can either copy and paste this into your syntax and add in the paragraph breaks where you desire (as this will just give you one long row of variables) or you can add in the paragraph breaks within Word first and then copy it into your syntax (example below)

Paragraph breaks manually added in Word, again format markings shown for clarification
After adding paragraph breaks in Word, this is what it will look like after copying and pasting it into your syntax.

That’s it! Depending on how many variables you have, the manual paragraph breaks afterwards can still be a bit time consuming, but much less time consuming than removing the paragraph breaks one variable at a time within the syntax.

If you are aware of an even faster approach, please let me know. If not, I hope this helps! Happy syntaxing.

Variable and Value Labels in SPSS

Let’s face it, a well prepped SPSS dataset has informative and accurate labels for each variable and their respective values. However, it’s all too easy to plow ahead and think you’ll remember what each obscure acronym you create in the moment and the values assigned to them will mean some years down the road. Maybe, maybe not, but what I know is that if you spend a little extra time prepping your dataset, you can save your colleagues or yourself a great deal of time that would be spent trying to understand what your past-self was thinking.

Luckily, the business of renaming variable and value labels is fairly straightforward, yet there are still some tips and tricks that you can use in special cases that I will mention below.

But first, I’ll quickly go over the basics.

Syntax for Labeling or Relabeling Variable Labels

Labeling one variable

VARIABLE LABELS varname ‘Type your variable label here’.

VARIABLE LABELS FPK ‘MEAN SCALE SCORE: Follower’s political knowledge’.

Labeling more than one variable

VARIABLE LABELS varname ‘Type your variable label here’
/varname2 ‘Type your variable label 2 here’
/varname3 ‘Type your variable label 3 here’.

VARIABLE LABELS FPK ‘MEAN SCALE SCORE: Follower’s political knowledge’
/FPS ‘MEAN SCALE SCORE: Follower’s political skill’
/FPW ‘MEAN SCALE SCORE: Follower’s political will’.

Syntax for Labeling or Relabeling Value Labels

Labeling the values for one variable

VALUE LABELS varname #’Type your value number here’.

VALUE LABELS FPK 1’Strongly disagree’ 2’Somewhat disagree’ 3’Neither agree nor disagree’ 4’Somewhat agree’ 5’Strongly agree’

Labeling the values for more than on consecutive variable

VALUE LABELS varname1 to varname9 #’Type your value number here’.

VALUE LABELS FPK1 to FPK9 1’Strongly disagree’ 2’Somewhat disagree’ 3’Neither agree nor disagree’ 4’Somewhat agree’ 5’Strongly agree’

Labeling the values for more than one non-consecutive variable

VALUE LABELS varname1 #’Type your value number here’
/varname6 #’Type your value number here’.

VALUE LABELS FPK1 1’Strongly disagree’ 2’Somewhat disagree’ 3’Neither agree nor disagree’ 4’Somewhat agree’ 5’Strongly agree’
/ABSENCE 0’No’ 1’Yes’.

Tips and Tricks for Renaming Variable Labels

The most important thing to remember when labeling or relabeling variable labels is that you have something for each variable. The idea is that you should understand what each variable is without having to open any other file or going back to your original survey or source material.

Often times, you will have special variables that you created solely to conduct analyses on, such as mean scale scores, clinical cut-off scores, and so forth. I find it helpful to make these important variables pop out by beginning their label with an all-caps description (e.g., MEAN SCALE SCORE: Follower’s political knowledge; CLINICAL CUTOFF SCORE: HADS depression).

Tips and Tricks for Renaming Value Labels

The same general informative tip applies to value labels. It’s easy to leave these blank, but you can make your life easier by labeling these where appropriate.

Occasionally your source material will have or produce wonky values and value labels for you that you want to change (recoding variables is another related but separate topic that I will write about soon). After recoding the variable values, there is a very easy method of removing the old value labels and replacing them with ones that match your updated values.

Here is the syntax:
VALUE LABELS varname #’Type your value label here’.

VALUE LABELS FPK 1’Strongly disagree’ 2’Somewhat disagree’ 3’Neither agree nor disagree’ 4’Somewhat agree’ 5’Strongly agree’

Here, the first VALUE LABELS command will remove the existing value labels and the second VALUE LABELS command will produce new value labels for your variable.

Project WIMH: Post #6

One of the arguments I’ve been working on in my proposal to explain the link between prior issues with mental health and subsequent work injuries is the role of cognitive resources (memory, attention, acuity, etc.).

The basic argument goes something like this: cognitive resources that are negatively impacted by mental health problems are the same resources that reduce the likelihood of experiencing a work injury.

While I was working through papers on the meta-analysis, I came across one that brought this idea to the forefront.

Arlinghaus and colleagues (2012) assessed the intermediary role of fatigue as a result of inadequate sleep in predicting work injuries. One of the core predictive variables of inadequate sleep that they assessed was psychological distress.

They find that psychological distress was not only directly related to an increased chance of experiencing a serious work injury, but that it was also indirectly related to experiencing a serious work injury through obtaining less sleep.

The implication of this is that the effect of mental health on cognitive resources is also complex, potentially reducing a persons day-to-day acuity and functioning by influencing other factors such as the amount of sleep they get the night before.


Arlinghaus, A., Lombardi, D. A., Willetts, J. L., Folkard, S., & Christiani, D. C. (2012). A structural equation modeling approach to fatigue-related risk factors for occupational injury. Am J Epidemiol, 176(7), 597-607. doi:10.1093/aje/kws219

Bicycle helmets

Do they matter?

The answer is an overwhelming yes.

Here are just a few numbers from a meta-analysis (i.e., a summary of all existing quantitative research) by Oliver & Creighton (2017) assessing the effectiveness of bicycle helmets in crashes and falls:

51% less likely to experience a head injury
69% less likely to experience a serious head injury
33% less likely to experience a facial injury
And 65% less likely to experience a fatal injury

To boot, other meta-analyses find relatively similar results (Attewell et al., 2001; Elvik, 2011; Høye, 2018).

So yes, bicycle helmets matter.

But recent innovations in bicycle helmet tech have improved their effectiveness a considerable amount.

Here I’m talking about WAVECEL and MIPS (Multi-Directional Impact Protection System).

While these two helmet technologies work in slightly different ways, they essentially soften the impact on the head by separating the helmet and your head from the initial shock.

With a traditional helmet, there is essentially a plastic and foam barrier between your head and what it hits, but your head rotates with the helmet at the same speed (and it’s this initial rotation and acceleration that leads to most head injuries, such as concussions and traumatic brain injuries).

With MIPS and WAVECEL, there is within the helmet a moving liner or collapsible structure, respectively, that decreases this rotation, and ultimately the chance of head injuries (Bliven et al., 2019).

So if you’re in the market for a helmet, I would highly recommend looking out for either MIPS or WAVECEL, with MIPS helmets tending to come in at slightly lower costs because the tech has been around for quite a bit longer.

If you’d like more information about bicycle helmet testing, check out the website for Virginia Tech’s helmet testing lab. They run comprehensive third-party testing on helmets for various sports, including cycling.


Attewell, R. G., Glase, K., & McFadden, M. (2001). Bicycle helmet efficacy: a meta-analysis. Accident Analysis & Prevention33(3), 345-352.Chicago

Bliven, E., Rouhier, A., Tsai, S., Willinger, R., Bourdet, N., Deck, C., … & Bottlang, M. (2019). Evaluation of a novel bicycle helmet concept in oblique impact testing. Accident Analysis & Prevention124, 58-65.

Elvik, R. (2011). Publication bias and time-trend bias in meta-analysis of bicycle helmet efficacy: a re-analysis of Attewell, Glase and McFadden, 2001. Accident Analysis & Prevention43(3), 1245-1251.

Høye, A. (2018). Bicycle helmets–To wear or not to wear? A meta-analyses of the effects of bicycle helmets on injuries. Accident Analysis & Prevention117, 85-97.

Olivier, J., & Creighton, P. (2017). Bicycle injuries and helmet use: a systematic review and meta-analysis. International Journal of Epidemiology46(1), 278-292.Chicago

Project WIMH: Post #5

To what extent could mental health explain the underreporting of work injuries?

A study by Zadow and colleagues (2017) examined whether emotional exhaustion, a core aspect of burnout and a common sign of mental health problems, predicted both reported and unreported injuries among hospital personnel.

They found that reported injuries were not statistically related to emotional exhaustion but unreported injuries were – and the difference between the correlational effect sizes (size of the standardized statistical relationship between injuries and emotional exhaustion) was fairly large (.11 to .30).

Too spent to go through the rigmarole of reporting injuries? Quite possibly.


Zadow, A. J., Dollard, M. F., McLinton, S. S., Lawrence, P., & Tuckey, M. R. (2017). Psychosocial safety climate, emotional exhaustion, and work injuries in healthcare workplaces. Stress Health. doi:10.1002/smi.2740

Project WIMH: Post #4

Almost done vetting the large folder of articles I pulled from the databases!

Came across an interesting paper by Simo Salminen and colleagues (2014) about whether stress captured by a single item (“Stress refers to a situation where a person feels tense, restless, nervous, or anxious, or is unable to sleep at night because his/her mind is troubled all the time. Do you feel that kind of stress these days?” p. 2) was associated with the risk of severe injury 8 years later.

Considering the paper was published, you can bet it does!

In fact, they found that individuals who rated their stress as high compared to those who rated it as low were roughly 42% more likely to experience a severe injury at the 8-year follow-up.

Oh, and this finding also controlled for age, gender, marital status, occupational status, education, and physical work environment.

However, greater clarity was gained when they broke down the overall sample by gender and occupation. Turns out that the association of this stress item with later severe injuries was only significant within males and individuals in blue-collar occupations (i.e., high stressed blue-collar males were more likely to experience a severe injury than their low stressed blue-collar male counterparts).

Goes to show that the bigger picture findings can sometimes mask what’s actually happening.


Salminen, S., Kouvonen, A., Koskinen, A., Joensuu, M., & Väänänen, A. (2014). Is a single item stress measure independently associated with subsequent severe injury: A prospective cohort study of 16,385 forest industry employees. BMC Public Health, 14(543), 1-7. 

Project WIHM: Post #3

The persistence of post-traumatic stress symptoms following an injury is pernicious.

Haagsma and colleagues (2010) followed up with a general population of patients 2 years after treatment for an injury.

Post-traumatic stress symptoms among these patients were negatively associated with almost all the functional and health-related quality of life measures in the study (e.g., problems with mobility, emotion, cognition, as well as considerably higher levels of pain, discomfort, anxiety & depression).

One take away from this study is the emphasis surrounding the treatment of physical AND psychological symptoms following an injury. If the psychological aspects of traumatic injuries are not rehabilitated in tandum with the physical aspects of injuries, there could be serious long-term consequences towards functioning and quality of life.

This is said in light of the study design limitations. Most importantly, the study does not allow one to be conclusive about the direction of the relationship between PTSD symptoms with functional and health-related quality of life (i.e., do PTSD symptoms lead to worse functioning/quality of life, the opposite, or is something else leading to both?). However, it does allow one to infer that individuals who continue to exhibit PTSD symptoms 2-years after an injury are far more likely to suffer from an overall lower quality of life.


Haagsma, J. A., Polinder, S., Olff, M., Toet, H., Bonsel, G. J., & van Beeck, E. F. (2012). Posttraumatic stress symptoms and health-related quality of life: A two year follow up study of injury treated at the emergency department. BMC Psychiatry, 12(1), 1-8. 

Project WIMH: Post #2

The article vetting process continues.

It can be hard to read through some of the research on this topic. Here is a quote from a qualitative study by Cacciarro & Kirsh (2006) on the mental health needs of injured workers:

“It’s just a domino effect. It’s affecting my children. My kids come home from school and I haven’t got dinner made because I haven’t got the energy to make it. And they’re, we want mom back. We want our old mom back.”


Nevermind the lack of compassion that injured workers often feel when dealing with compensation systems, the alienation and stigma surrounding injuries, and having to come to terms with temporary or permanent unemployment.

That aside, my supervisor and I (along with several other colleagues) have started to look at these indirect or vicarious effects of work injuries on the mental health of teenagers and some preliminary findings suggest that living with an injured parent has a bigger detrimental impact on mental health than do injuries experienced directly by young workers. An area of research that I suspect will get increasing attention in the coming years.


Cacciacarro, L., & Kirsh, B. (2006). Exploring the mental health needs of injured workers. Candian Journal of Occupational Therapy, 73(3), 178-187.

Project WIMH: Post #1

Back at it again. It’s been a while since I’ve had an opportunity to move this project forward on the empirical side.

To help with this process, I’ve decided to begin blogging my efforts towards completing Project Work Injury and Mental Health (WIMH).

Over the last semester I finally wrapped up the database search, which consisted of a ludicrous amount of screening (~23,000 articles!).

I also had the great opportunity to present some of the preliminary findings at SIOP 2019 in a symposium on mental health at the workplace. I’m very grateful to Dr. Jennifer Dimoff and her PhD student, Stefanie Fox, for organizing the symposium.

Now that I’ve screened all the articles from the database search, it’s time to vet through the articles I pulled. Usually you have to be pretty intellectually ruthless with this process, but sometimes you can’t help spending too much time on interesting articles.

For instance…

…Betters (2010) found that individuals who were injured at work were more likely to gain weight if they thought they would benefit from mental health services (albeit, no effect size was provided), hinting that the pressure to reduce the discprepancy between where they are physically with where they want to be is having psychological consequences.

…Blake and colleagues (2014) found that over close to 50% of individuals who witness work-related fatalities experience probable or sub-threshold PTSD symptoms, which in turn have striking effects on depression, life functioning, and well-being. This research highlights the importance of psychological interventions for dealing with traumatic events at work.

Anyways, back to being ruthless for a bit as I vet through the pulled articles!


Betters, C. J. (2010). Weight gain and work comp: A growing problem in the workers’ compensation rehabilitation system. Work, 37(1), 23-27. doi:10.3233/WOR-2010-1053

Blake, R. A., Lating, J. M., Sherman, M. F., & Kirkhart, M. W. (2014). Probable PTSD and Impairment in Witnesses of Work-Related Fatalities. Journal of Loss and Trauma, 19(2), 189-195. doi:10.1080/15325024.2013.775889

Remove Cases in SPSS

Notice some outliers or problematic cases in your dataset and want a shorthand way to quickly remove them while also keeping a record of which cases you removed? No problem, there are numerous ways to approach this.

If it is just one or a few numerical cases, then a great shorthand is:




With this syntax, replace VARNAME with the identifying variables (i.e., the variable that will identify the case you want to remove) and CASE with the specific entry within that variable. For instance, if your VARNAME is ID and the CASE you want to drop is 653, then your syntax would look like this:

SELECT IF ID <> 653.


SELECT IF (ID ne 653).

If you have a few cases rather than just one, the latter syntax may be more efficient to use. For example, imagine you also have cases 155, 374, and 416 you want to remove. Here is what the syntax would look like:

SELECT IF (ID ne 653 and ID ne 155 and ID ne 374 and ID ne 416).

You can also use the the exact same syntax with string variables by adding ‘ ‘ around the entry that would identify the case you want to remove. For example:

SELECT IF (NAME ne ‘Dave’).
SELECT IF (NAME ne ‘Dave’ and NAME ne ‘Bob’ and NAME ne ‘Bill’).

If you have a large dataset and want to remove a good chunk of cases – say you have a number of cases that are missing on a key variable – then you can use the following syntax:

SELECT IF (not missing(VARNAME)).

You may come across circumstances where you need to get more creative with your case removal syntax, but in general these are the basic approaches you’ll most often use. As I come across new strategies for removing cases in SPSS, I will be sure to add them to this post for reference.

[More to come]