I am not sure of the output you want since you did not post an example of the final data frame. I have guessed that you want three columns in addition to the pid column. I give two examples of regular expressions to divide the column names into variable values. The first one assumes that the "survey", the letter before the number, is always one character and that the number is also always one character. The second one allows for the survey to be multiple letters and for the number to have multiple digits.
library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.1.2
widedata <- structure(list(pid = c(1, 2, 3, 4, 5, 6, 7),
d1reputin = c(3, 2, NA, 1, 1, NA, 4),
d1dispu = c(10, 5, 2, NA, 3, 5, 3),
d2reputin = c(4, 3, 2, 4, 1, 1, 3),
d2dispu = c(10, 5, 2, NA, 3, 5, 3),
d3reputin = c(3, 2, NA, 5, 2, 3, 4),
d3dispu = c(10, 5, 2, NA, 3, 5, 6),
w1wiss = c(5, 5, 4, 5, 3, 1, 5),
m1gradv = c(0, NA, 1, 1, 0, 1, 0),
w2wiss = c(5, 4, 4, 5, 3, 3, 5),
m2gradv = c(0, 1, 1, 1, 0, NA, NA),
w3wiss = c(5, 5, 4, 5, 5, 3, 4),
w3gradv = c(0, NA, 1, 1, 0, NA, 1)),
row.names = c(NA, 7L), class = "data.frame")
pivot_longer(widedata,cols = -pid,
names_to = c("survey","period","var"),
names_pattern = "(.)(.)(.+)") #(one character)(one character)(one or more characters)
#> # A tibble: 84 x 5
#> pid survey period var value
#> <dbl> <chr> <chr> <chr> <dbl>
#> 1 1 d 1 reputin 3
#> 2 1 d 1 dispu 10
#> 3 1 d 2 reputin 4
#> 4 1 d 2 dispu 10
#> 5 1 d 3 reputin 3
#> 6 1 d 3 dispu 10
#> 7 1 w 1 wiss 5
#> 8 1 m 1 gradv 0
#> 9 1 w 2 wiss 5
#> 10 1 m 2 gradv 0
#> # ... with 74 more rows
pivot_longer(widedata,cols = -pid,
names_to = c("survey","period","var"),
names_pattern = "([[:alpha:]]+)(\\d+)(.+)") #(one or more letters)(one or more numbers)(one or more characters)
#> # A tibble: 84 x 5
#> pid survey period var value
#> <dbl> <chr> <chr> <chr> <dbl>
#> 1 1 d 1 reputin 3
#> 2 1 d 1 dispu 10
#> 3 1 d 2 reputin 4
#> 4 1 d 2 dispu 10
#> 5 1 d 3 reputin 3
#> 6 1 d 3 dispu 10
#> 7 1 w 1 wiss 5
#> 8 1 m 1 gradv 0
#> 9 1 w 2 wiss 5
#> 10 1 m 2 gradv 0
#> # ... with 74 more rows
Created on 2022-05-20 by the reprex package (v2.0.1)