I have some sample data pasted below.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(studentid year schoolid)
1001 1 109
1001 1 109
1001 2 121
1001 2 121
end
I want to create two new variables based on schoolid for each respective year. One new column for a variable representing schoolid1 with values of 109 going down and another column representing schoolid2 with values of 121 going down. The table below is what I'd ideally want.

studentid year schoolid schoolid1 schoolid2
1001 1 109 109 121
1001 1 109 109 121
1001 2 121 109 121
1001 2 121 109 121

I'd appreciate any suggestions! Thank you!