Dear All,

The issue I am trying to resolve here is as follows-
I have a dataset where customers purchase products from multiple brands in a single order, identified by "Order_id". The variable "Brand", has 5 unique values, but in a single order it may be present once or more than once. I want to create new columns with the brand name, which indicates if it was present in a certain order (i.e. takes values of 1/0 in the new column). Please find below an example:
My existing data:

Order_id Brand
100 A
100 B
100 C
101 D
101 D
102 E
102 A
102 C
102 A

What I want to create is something like this:

Order_id Brand A B C D E
100 A 1
100 B 1
100 C 1
101 D 1
101 D 1
102 E 1
102 A 1
102 C 1
102 A 1

Please let me know if this explanation is clear, and if there is a way to do it in Stata?

Thanks!