I'm hoping someone can help me recreate the following SAS code in STATA.

if first.studyid_adult then do;
spelnmbr=1;
duration=1;
startm=sm;
end;
else duration + 1;
obplus=_n_ + 1;