We don’t currently have this implemented in DataFrames. Multi-column unstack calls are not yet supported. The best I can do is unstack(df, "CAT", "ID") and unstack(df, "CAT", "ST") and join the two together.
I think there is an issue in DataFrames for this here. So this is being tracked, as far as I can tell.
Thanks for the suggestions and the reference to the issue where a similar topic is discussed but in a very general way.
At the moment I was able to find these 2 solutions.
####### sol 1 #########
id=unstack(df,:CAT,:ID;renamecols=x->Symbol(x,:_ID))
st=unstack(df,:CAT,:ST;renamecols=x->Symbol(x,:_ST))
idst=hcat(id,st)
cols=sort(names(idst))[1:end-2]
select(idst,cols)
###### sol 2########
df1=combine(df,names(df), [:ID,:ST]=>ByRow(string)=>:ID_ST)
udf=unstack(df1,:CAT,:ID_ST)
colsin=names(udf, x->x ∉ ["ID","ST"])
colsout=collect.(zip([string.(cols,pf) for pf in ["_ID","_ST"]]...))
combine(udf,colsin.=>ByRow(x->ismissing(x) ? [missing,missing] : split(x,"")).=>colsout)
I believe there are others with the use of the groupby, transform, combine and other functions