You have the following information:
Package A: 18 soda
Package B: 12 soda
In order to write an equation for the number of sodas g, for p packages, you consider that 1 package represent a specific number of sodas.
You can write for both cases:
Package A: g = 18p
Package B: g = 12p
where g is the number of sodas and p the number of packages.
You can notice that for p = 1, g = 18 and g = 12, which is in agree with the problem. For greater values of p the number of sodas will increase.