Hello! So I have a dataset with almost two hundred schools and each school has hundreds of students. I'm trying to add 2 variables to the dataset tied to each school/schoolid. I tried to merge the data (see below) by schoolid, but that only outputed as many results as there are schools. It also dropped all the variables in the original dataset, except for schoolid. How can I add the 2 new variables and have them repeated for each student at the corresponding school? I have an example of the code I ran below: data newvariables;
input schoolid var1 var2$;
cards;
1 60 y
2 53 N
3 80 Y
4 20 N
;
RUN;
DATA mergeddata;
merge olddataset newvariables;
by schoolid;
run;
... View more